Skip to content

Commit 65b7329

Browse files
committed
fix: removed custom line drawing to look more like Unity native
1 parent e5ef8bb commit 65b7329

File tree

3 files changed

+7
-46
lines changed

3 files changed

+7
-46
lines changed

Editor/Drawers/RawReferenceDrawer.Styles.cs

Lines changed: 0 additions & 21 deletions
This file was deleted.

Editor/Drawers/RawReferenceDrawer.Styles.cs.meta

Lines changed: 0 additions & 3 deletions
This file was deleted.

Editor/Drawers/RawReferenceDrawer.cs

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -51,34 +51,19 @@ public void OnGUI(Rect position)
5151

5252
if (rawReferenceValue == null)
5353
return;
54-
55-
DrawLine(position);
54+
5655
DrawProperty(position);
57-
5856
previousPropertyPath = Property.propertyPath;
5957
}
6058

6159
private void DrawProperty(Rect position)
6260
{
63-
Rect objectDrawerRect = new Rect(position);
64-
65-
EditorGUI.PropertyField(objectDrawerRect,
61+
EditorGUI.PropertyField(position,
6662
RawReferenceProperty,
6763
GUIContent.none,
6864
true);
6965
}
7066

71-
private void DrawLine(Rect position)
72-
{
73-
Rect line = new Rect(position)
74-
{
75-
width = 5,
76-
yMin = position.yMin + EditorGUIUtility.singleLineHeight,
77-
x = position.x + EditorGUI.indentLevel * 15 - 9
78-
};
79-
EditorGUI.DrawRect(line, Styles.LineColor);
80-
}
81-
8267
protected override void PingObject(SerializedProperty property)
8368
{
8469
// No support for pinging raw objects for now (I guess this would ping the MonoScript?)
@@ -89,7 +74,7 @@ protected override void OnPropertiesClicked(SerializedProperty property)
8974
{
9075
if (RawReferenceValue == null)
9176
return;
92-
77+
9378
Type type = RawReferenceValue.GetType();
9479
string typeName = type.Name;
9580

@@ -108,12 +93,12 @@ protected override void OnPropertiesClicked(SerializedProperty property)
10893

10994
private void AvoidDuplicateReferencesInArray()
11095
{
111-
if (!ShouldCheckProperty())
96+
if (!ShouldCheckProperty())
11297
return;
11398

11499
object currentReferenceValue = RawReferenceValue;
115100

116-
if (currentReferenceValue == null)
101+
if (currentReferenceValue == null)
117102
return;
118103

119104
if (previousReferenceValue == currentReferenceValue)
@@ -127,8 +112,8 @@ private void AvoidDuplicateReferencesInArray()
127112

128113
private bool ShouldCheckProperty()
129114
{
130-
return IsPropertyInArray(Property) &&
131-
previousPropertyPath != null &&
115+
return IsPropertyInArray(Property) &&
116+
previousPropertyPath != null &&
132117
previousPropertyPath != Property.propertyPath;
133118
}
134119

0 commit comments

Comments
 (0)