Skip to content

Commit e2a9638

Browse files
authored
Merge pull request #43 from marc-antoine-girard/fix-merge-missing-features
2 parents d9dff45 + 4995692 commit e2a9638

File tree

3 files changed

+15
-9
lines changed

3 files changed

+15
-9
lines changed

Editor/Drawers/RawReferenceDrawer.cs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,7 @@ protected override void OnPropertiesClicked()
108108

109109
private void AvoidDuplicateReferencesInArray()
110110
{
111-
if (!IsPropertyInArray(Property))
112-
return;
113-
if (previousPropertyPath == null)
114-
return;
115-
if (previousPropertyPath == Property.propertyPath)
111+
if (!ShouldCheckProperty())
116112
return;
117113

118114
object currentReferenceValue = RawReferenceValue;
@@ -121,11 +117,21 @@ private void AvoidDuplicateReferencesInArray()
121117
return;
122118

123119
if (previousReferenceValue == currentReferenceValue)
124-
PropertyValue = CreateInstance(currentReferenceValue);
120+
{
121+
currentReferenceValue = CreateInstance(currentReferenceValue);
122+
PropertyValue = currentReferenceValue;
123+
}
125124

126125
previousReferenceValue = currentReferenceValue;
127126
}
128127

128+
private bool ShouldCheckProperty()
129+
{
130+
return IsPropertyInArray(Property) &&
131+
previousPropertyPath != null &&
132+
previousPropertyPath != Property.propertyPath;
133+
}
134+
129135
private static bool IsPropertyInArray(SerializedProperty prop)
130136
{
131137
return prop.propertyPath.Contains(".Array.data[");

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ And when you click on the object selector button you will be shown a dropdown wi
6161
![image](https://user-images.githubusercontent.com/5531467/164994604-15a0d060-72d1-440b-926b-883dd5f31955.png)
6262

6363
As you can see you can select items from multiple locations:
64-
- Assets (Scriptable Objects that implement said interface)
64+
- Assets (Scriptable Objects and Prefabs that implement said interface)
6565
- Classes (custom classes that implement said interface)
6666
- Scene (objects in the scene that implement said interface)
6767

Runtime/ReferenceMode.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
{
33
internal enum ReferenceMode
44
{
5-
Raw,
6-
Unity
5+
Unity,
6+
Raw
77
}
88
}

0 commit comments

Comments
 (0)