File tree 3 files changed +15
-9
lines changed
3 files changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -108,11 +108,7 @@ protected override void OnPropertiesClicked()
108
108
109
109
private void AvoidDuplicateReferencesInArray ( )
110
110
{
111
- if ( ! IsPropertyInArray ( Property ) )
112
- return ;
113
- if ( previousPropertyPath == null )
114
- return ;
115
- if ( previousPropertyPath == Property . propertyPath )
111
+ if ( ! ShouldCheckProperty ( ) )
116
112
return ;
117
113
118
114
object currentReferenceValue = RawReferenceValue ;
@@ -121,11 +117,21 @@ private void AvoidDuplicateReferencesInArray()
121
117
return ;
122
118
123
119
if ( previousReferenceValue == currentReferenceValue )
124
- PropertyValue = CreateInstance ( currentReferenceValue ) ;
120
+ {
121
+ currentReferenceValue = CreateInstance ( currentReferenceValue ) ;
122
+ PropertyValue = currentReferenceValue ;
123
+ }
125
124
126
125
previousReferenceValue = currentReferenceValue ;
127
126
}
128
127
128
+ private bool ShouldCheckProperty ( )
129
+ {
130
+ return IsPropertyInArray ( Property ) &&
131
+ previousPropertyPath != null &&
132
+ previousPropertyPath != Property . propertyPath ;
133
+ }
134
+
129
135
private static bool IsPropertyInArray ( SerializedProperty prop )
130
136
{
131
137
return prop . propertyPath . Contains ( ".Array.data[" ) ;
Original file line number Diff line number Diff line change @@ -61,7 +61,7 @@ And when you click on the object selector button you will be shown a dropdown wi
61
61
![ image] ( https://user-images.githubusercontent.com/5531467/164994604-15a0d060-72d1-440b-926b-883dd5f31955.png )
62
62
63
63
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)
65
65
- Classes (custom classes that implement said interface)
66
66
- Scene (objects in the scene that implement said interface)
67
67
Original file line number Diff line number Diff line change 2
2
{
3
3
internal enum ReferenceMode
4
4
{
5
- Raw ,
6
- Unity
5
+ Unity ,
6
+ Raw
7
7
}
8
8
}
You can’t perform that action at this time.
0 commit comments