Skip to content

Commit dbff69a

Browse files
committed
remove redundant code
1 parent 7e7e421 commit dbff69a

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

Packages/com.unity.inputsystem/InputSystem/Editor/ControlPicker/InputControlPathEditor.cs

+10-10
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public InputControlPathEditor(SerializedProperty pathProperty, InputControlPicke
3030
{
3131
if (pathProperty == null)
3232
throw new ArgumentNullException(nameof(pathProperty));
33-
33+
Debug.Log($"New Path Property on {pathProperty.serializedObject.targetObject.GetInstanceID()}");
3434
this.pathProperty = pathProperty;
3535
this.onModified = onModified;
3636
m_PickerState = pickerState ?? new InputControlPickerState();
@@ -78,10 +78,9 @@ public void OnGUI()
7878
EditorGUILayout.EndHorizontal();
7979
}
8080

81-
public void OnGUI(Rect rect, GUIContent label = null, SerializedProperty property = null, Action modifiedCallback = null)
81+
public void OnGUI(Rect rect, GUIContent label = null, Action modifiedCallback = null)
8282
{
8383
var pathLabel = label ?? m_PathLabel;
84-
var serializedProperty = property ?? pathProperty;
8584

8685
var lineRect = rect;
8786
var labelRect = lineRect;
@@ -103,7 +102,7 @@ public void OnGUI(Rect rect, GUIContent label = null, SerializedProperty propert
103102
var path = String.Empty;
104103
try
105104
{
106-
path = serializedProperty.stringValue;
105+
path = pathProperty.stringValue;
107106
}
108107
catch
109108
{
@@ -128,8 +127,8 @@ public void OnGUI(Rect rect, GUIContent label = null, SerializedProperty propert
128127
path = EditorGUI.DelayedTextField(bindingTextRect, path);
129128
if (EditorGUI.EndChangeCheck())
130129
{
131-
serializedProperty.stringValue = path;
132-
serializedProperty.serializedObject.ApplyModifiedProperties();
130+
pathProperty.stringValue = path;
131+
pathProperty.serializedObject.ApplyModifiedProperties();
133132
(modifiedCallback ?? onModified).Invoke();
134133
}
135134
}
@@ -138,9 +137,9 @@ public void OnGUI(Rect rect, GUIContent label = null, SerializedProperty propert
138137
// Dropdown that shows binding text and allows opening control picker.
139138
if (EditorGUI.DropdownButton(bindingTextRect, new GUIContent(displayName), FocusType.Keyboard))
140139
{
141-
SetExpectedControlLayoutFromAttribute(serializedProperty);
140+
SetExpectedControlLayoutFromAttribute(pathProperty);
142141
////TODO: for bindings that are part of composites, use the layout information from the [InputControl] attribute on the field
143-
ShowDropdown(bindingTextRect, serializedProperty, modifiedCallback ?? onModified);
142+
ShowDropdown(bindingTextRect, modifiedCallback ?? onModified);
144143
}
145144
}
146145

@@ -149,7 +148,7 @@ public void OnGUI(Rect rect, GUIContent label = null, SerializedProperty propert
149148
EditorStyles.miniButton);
150149
}
151150

152-
private void ShowDropdown(Rect rect, SerializedProperty serializedProperty, Action modifiedCallback)
151+
private void ShowDropdown(Rect rect, Action modifiedCallback)
153152
{
154153
#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS
155154
InputActionsEditorSettingsProvider.SetIMGUIDropdownVisible(true, false);
@@ -160,7 +159,8 @@ private void ShowDropdown(Rect rect, SerializedProperty serializedProperty, Acti
160159
m_PickerState,
161160
path =>
162161
{
163-
serializedProperty.stringValue = path;
162+
Debug.Log($"Saving path to property on {pathProperty.serializedObject.targetObject.GetInstanceID()}");
163+
pathProperty.stringValue = path;
164164
m_PickerState.manualPathEditMode = false;
165165
modifiedCallback();
166166
});

Packages/com.unity.inputsystem/InputSystem/Editor/PropertyDrawers/InputControlPathDrawer.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public override void OnGUI(Rect position, SerializedProperty property, GUIConten
4444
}
4545

4646
EditorGUI.BeginProperty(position, label, property);
47-
m_Editor.OnGUI(position, label, property, () => property.serializedObject.ApplyModifiedProperties());
47+
m_Editor.OnGUI(position, label, () => property.serializedObject.ApplyModifiedProperties());
4848
EditorGUI.EndProperty();
4949
}
5050
}

0 commit comments

Comments
 (0)