Skip to content

Commit cbd6194

Browse files
Fix issues during merge
1 parent bee1446 commit cbd6194

File tree

3 files changed

+9
-30
lines changed

3 files changed

+9
-30
lines changed

Editor/Drawers/RawReferenceDrawer.cs

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -14,32 +14,9 @@ internal class RawReferenceDrawer : ReferenceDrawer, IReferenceDrawer
1414
private object previousReferenceValue;
1515
private string previousPropertyPath;
1616

17-
private object RawReferenceValue
18-
{
19-
get
20-
{
21-
#if UNITY_2021_1_OR_NEWER
22-
return RawReferenceProperty.managedReferenceValue;
23-
#else
24-
ISerializableInterface instance =
25-
(ISerializableInterface)fieldInfo.GetValue(Property.serializedObject.targetObject);
26-
return instance.GetRawReference();
27-
#endif
28-
}
29-
30-
set
31-
{
32-
#if UNITY_2021_1_OR_NEWER
33-
RawReferenceProperty.managedReferenceValue = value;
34-
#else
35-
fieldInfo.SetValue(Property.serializedObject.targetObject, value);
36-
#endif
37-
}
38-
}
39-
4017
public void Initialize(SerializedProperty property, Type genericType, GUIContent label, FieldInfo fieldInfo)
4118
{
42-
Initialize(property, genericType);
19+
Initialize(property, genericType, fieldInfo);
4320
this.label = label;
4421
}
4522

Editor/Drawers/ReferenceDrawer.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ private enum DragAndDropMode
3131
protected SerializedProperty RawReferenceProperty => Property.FindPropertyRelative("rawReference");
3232
protected SerializedProperty UnityReferenceProperty => Property.FindPropertyRelative("unityReference");
3333

34-
protected readonly FieldInfo fieldInfo;
34+
protected FieldInfo FieldInfo { get; private set; }
3535

3636
protected ReferenceMode ModeValue
3737
{
@@ -47,7 +47,7 @@ protected object RawReferenceValue
4747
return RawReferenceProperty.managedReferenceValue;
4848
#else
4949
ISerializableInterface instance =
50-
(ISerializableInterface)fieldInfo.GetValue(Property.serializedObject.targetObject);
50+
(ISerializableInterface)FieldInfo.GetValue(Property.serializedObject.targetObject);
5151
return instance.GetRawReference();
5252
#endif
5353
}
@@ -56,7 +56,7 @@ protected object RawReferenceValue
5656
#if UNITY_2021_1_OR_NEWER
5757
RawReferenceProperty.managedReferenceValue = value;
5858
#else
59-
fieldInfo.SetValue(Property.serializedObject.targetObject, value);
59+
FieldInfo.SetValue(Property.serializedObject.targetObject, value);
6060
#endif
6161
}
6262
}
@@ -101,10 +101,11 @@ protected ReferenceDrawer()
101101
CustomObjectDrawer.PropertiesClicked += OnPropertiesClicked;
102102
}
103103

104-
protected void Initialize(SerializedProperty property, Type genericType)
104+
protected void Initialize(SerializedProperty property, Type genericType, FieldInfo fieldInfo)
105105
{
106106
Property = property;
107107
GenericType = genericType;
108+
FieldInfo = fieldInfo;
108109
}
109110

110111
private void OnButtonClicked(Rect position)
@@ -137,6 +138,7 @@ private void OnClicked()
137138

138139
private void OnDeletePressed()
139140
{
141+
ModeValue = default;
140142
PropertyValue = null;
141143
}
142144

Editor/Drawers/UnityReferenceDrawer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ internal class UnityReferenceDrawer : ReferenceDrawer, IReferenceDrawer
1111
{
1212
private GUIContent label;
1313

14-
public void Initialize(SerializedProperty property, Type genericType, GUIContent label)
14+
public void Initialize(SerializedProperty property, Type genericType, GUIContent label, FieldInfo fieldInfo)
1515
{
16-
Initialize(property, genericType);
16+
Initialize(property, genericType, fieldInfo);
1717
this.label = label;
1818
}
1919

0 commit comments

Comments
 (0)