File tree Expand file tree Collapse file tree 3 files changed +15
-9
lines changed Expand file tree Collapse file tree 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()
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[" ) ;
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
6161![ image] ( https://user-images.githubusercontent.com/5531467/164994604-15a0d060-72d1-440b-926b-883dd5f31955.png )
6262
6363As 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
Original file line number Diff line number Diff line change 22{
33 internal enum ReferenceMode
44 {
5- Raw ,
6- Unity
5+ Unity ,
6+ Raw
77 }
88}
You can’t perform that action at this time.
0 commit comments