File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,20 @@ internal sealed class SerializableInterfacePropertyDrawer : PropertyDrawer
2222
2323 private ReferenceMode ReferenceMode => ( ReferenceMode ) ReferenceModeProperty . enumValueIndex ;
2424
25+ private object RawReferenceValue
26+ {
27+ get
28+ {
29+ #if UNITY_2021_1_OR_NEWER
30+ return RawReferenceProperty . managedReferenceValue ;
31+ #else
32+ ISerializableInterface instance =
33+ ( ISerializableInterface ) fieldInfo . GetValue ( serializedProperty . serializedObject . targetObject ) ;
34+ return instance . GetRawReference ( ) ;
35+ #endif
36+ }
37+ }
38+
2539 /// <inheritdoc />
2640 public override bool CanCacheInspectorGUI ( SerializedProperty property )
2741 {
@@ -113,13 +127,13 @@ Type genericArgument
113127
114128 EditorGUI . PropertyField ( objectDrawerRect ,
115129 RawReferenceProperty ,
116- new GUIContent ( RawReferenceProperty . managedReferenceValue . GetType ( ) . Name ) ,
130+ new GUIContent ( RawReferenceValue . GetType ( ) . Name ) ,
117131 true ) ;
118132 }
119133
120134 private void DrawRawReference ( Rect position )
121135 {
122- Type type = RawReferenceProperty . managedReferenceValue . GetType ( ) ;
136+ Type type = RawReferenceValue . GetType ( ) ;
123137 string typeName = type . Name ;
124138 IEnumerable < MonoScript > scripts = AssetDatabase . FindAssets ( $ "t:Script { typeName } ")
125139 . Select ( AssetDatabase . GUIDToAssetPath )
You can’t perform that action at this time.
0 commit comments