Skip to content

Commit 1a206ae

Browse files
committed
fix API and adjust comments.
1 parent 017782c commit 1a206ae

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

Packages/com.unity.inputsystem/InputSystem/Editor/AssetEditor/InputBindingPropertiesView.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ private static void DrawMatchingControlPaths(List<MatchingControlPath> matchingC
149149
private void DrawMatchingControlPaths()
150150
{
151151
bool controlPathUsagePresent = false;
152-
List<MatchingControlPath> matchingControlPaths = MatchingControlPath.CollectMatchingControlPaths(InputControlPathEditor.pathProperty.stringValue, showMatchingLayouts, ref controlPathUsagePresent);
152+
List<MatchingControlPath> matchingControlPaths = MatchingControlPath.CollectMatchingControlPaths(m_ControlPathEditor.pathProperty.stringValue, showMatchingLayouts, ref controlPathUsagePresent);
153153
if (matchingControlPaths == null || matchingControlPaths.Count != 0)
154154
{
155155
EditorGUILayout.BeginVertical();

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public InputControlPathEditor(SerializedProperty pathProperty, InputControlPicke
3232
throw new ArgumentNullException(nameof(pathProperty));
3333
// Update the static pathProperty variable to the most recent serializedProperty.
3434
// See comment on pathProperty for more information.
35-
InputControlPathEditor.pathProperty = pathProperty;
35+
s_pathProperty = pathProperty;
3636
this.onModified = onModified;
3737
m_PickerState = pickerState ?? new InputControlPickerState();
3838
m_PathLabel = label ?? new GUIContent(pathProperty.displayName, pathProperty.GetTooltip());
@@ -184,12 +184,15 @@ private void SetExpectedControlLayoutFromAttribute(SerializedProperty property)
184184
}
185185

186186
// This static variable is a hack. Because the editor is rebuilt at unpredictable times with a new serializedObject, we need to keep updating
187-
// This variable with most up to date serializedProperty, so that the picker dropdown can access the correct serializedProperty.
188-
// This variable with most up to date serializedProperty, so that the picker dropdown can access the correct serializedProperty.
187+
// this variable with most up to date serializedProperty, so that the picker dropdown can access the correct serializedProperty.
189188
// The picker dropdown is a separate window and does not have access to the changed serializedObject reference.
190-
// This is a temporary solution until the InputControlPathEditor is converted to UITK or there is away to have a stable, persistent serializedObject backing this editor.
189+
// This could be removed if the InputControlPathEditor is converted to UITK with a stable, persistent serializedObject backing this editor.
191190
// This property will be shared among multiple asset editor windows.
192-
public static SerializedProperty pathProperty { get; private set; }
191+
private static SerializedProperty s_pathProperty { get; set; }
192+
193+
// This property will always return the most recent serializedProperty.
194+
public SerializedProperty pathProperty { get => s_pathProperty;}
195+
193196
public Action onModified { get; }
194197

195198
private GUIContent m_PathLabel;

0 commit comments

Comments
 (0)