Skip to content

Commit 693da10

Browse files
Update RawReferenceDrawer.cs
1 parent 2199452 commit 693da10

File tree

1 file changed

+1
-29
lines changed

1 file changed

+1
-29
lines changed

Editor/Drawers/RawReferenceDrawer.cs

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,34 +9,10 @@ namespace TNRD.Drawers
99
internal class RawReferenceDrawer : ReferenceDrawer, IReferenceDrawer
1010
{
1111
private readonly GUIContent label;
12-
private readonly FieldInfo fieldInfo;
1312

1413
private static object previousReferenceValue;
1514
private static string previousPropertyPath;
1615

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-
4016
/// <inheritdoc />
4117
public RawReferenceDrawer(SerializedProperty property, GUIContent label, Type genericType, FieldInfo fieldInfo)
4218
: base(property, genericType, fieldInfo)
@@ -125,17 +101,13 @@ private void AvoidDuplicateReferencesInArray()
125101
if (previousPropertyPath == Property.propertyPath)
126102
return;
127103

128-
SerializedProperty rawReferenceProperty = Property.FindPropertyRelative("rawReference");
129104
object currentReferenceValue = RawReferenceValue;
130105

131106
if (currentReferenceValue == null)
132107
return;
133108

134109
if (previousReferenceValue == currentReferenceValue)
135-
{
136-
RawReferenceValue = CreateInstance(currentReferenceValue);
137-
rawReferenceProperty.serializedObject.ApplyModifiedProperties();
138-
}
110+
PropertyValue = CreateInstance(currentReferenceValue);
139111

140112
previousReferenceValue = currentReferenceValue;
141113
}

0 commit comments

Comments
 (0)