Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Packages/com.unity.inputsystem/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ however, it has to be formatted properly to pass verification tests.
- Fixed an editor crash caused by input debugger device state window reusing cached state when reconnecting Stadia controller. [ISXB-658](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-658)
- Fixed an issue where batch jobs would fail with "Error: Error building Player because scripts are compiling" if a source generated .inputactions asset is out of sync with its generated source code (ISXB-1300).
- Fixed multiple `OnScreenStick` Components that does not work together when using them simultaneously in isolation mode. [ISXB-813](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-813)
- Fixed an issue in input actions editor window that caused certain fields in custom input composite bindings to require multiple clicks to action / focus. [ISXB-1171](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1171)

### Changed
- Changed location of the link xml file (code stripping rules), from a temporary directory to the project Library folder (ISX-2140).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ private void OnFocusOut(FocusOutEvent @event = null)
DelayFocusLost(element == null);
}

private void OnStateChanged(InputActionsEditorState newState)
private void OnStateChanged(InputActionsEditorState newState, UIRebuildMode editorRebuildMode)
{
#if UNITY_INPUT_SYSTEM_INPUT_ACTIONS_EDITOR_AUTO_SAVE_ON_FOCUS_LOST
// No action, auto-saved on edit-focus lost
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ private void BuildUI()
m_StateContainer.Initialize(rootVisualElement.Q("action-editor"));
}

private void OnStateChanged(InputActionsEditorState newState)
private void OnStateChanged(InputActionsEditorState newState, UIRebuildMode editorRebuildMode)
{
DirtyInputActionsEditorWindow(newState);
m_State = newState;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,16 @@

namespace UnityEngine.InputSystem.Editor
{
// Enum used to dictate if a state change should rebuild the Input Actions editor UI
internal enum UIRebuildMode
{
None,
Rebuild,
}

internal class StateContainer
{
public event Action<InputActionsEditorState> StateChanged;
public event Action<InputActionsEditorState, UIRebuildMode> StateChanged;

private VisualElement m_RootVisualElement;
private InputActionsEditorState m_State;
Expand All @@ -21,7 +28,7 @@ public StateContainer(InputActionsEditorState initialState, string assetGUID)
this.assetGUID = assetGUID;
}

public void Dispatch(Command command)
public void Dispatch(Command command, UIRebuildMode editorRebuildMode = UIRebuildMode.Rebuild)
{
if (command == null)
throw new ArgumentNullException(nameof(command));
Expand All @@ -36,7 +43,7 @@ public void Dispatch(Command command)
// catch exceptions here or the UIToolkit scheduled event will keep firing forever.
try
{
StateChanged?.Invoke(m_State);
StateChanged?.Invoke(m_State, editorRebuildMode);
}
catch (Exception e)
{
Expand All @@ -55,9 +62,9 @@ public void Initialize(VisualElement rootVisualElement)
m_RootVisualElement.Unbind();
m_RootVisualElement.TrackSerializedObjectValue(m_State.serializedObject, so =>
{
StateChanged?.Invoke(m_State);
StateChanged?.Invoke(m_State, UIRebuildMode.Rebuild);
});
StateChanged?.Invoke(m_State);
StateChanged?.Invoke(m_State, UIRebuildMode.Rebuild);
rootVisualElement.Bind(m_State.serializedObject);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public override void RedrawUI(ViewState viewState)

viewState.parameterListView.onChange = () =>
{
Dispatch(Commands.UpdatePathNameAndValues(viewState.parameterListView.GetParameters(), viewState.selectedBindingPath));
Dispatch(Commands.UpdatePathNameAndValues(viewState.parameterListView.GetParameters(), viewState.selectedBindingPath), UIRebuildMode.None);
};
viewState.parameterListView.OnDrawVisualElements(rootElement);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,12 @@ protected ViewBase(VisualElement root, StateContainer stateContainer)
m_ChildViews = new List<IView>();
}

protected void OnStateChanged(InputActionsEditorState state)
protected void OnStateChanged(InputActionsEditorState state, UIRebuildMode editorRebuildMode)
{
// Return early if rebuilding the editor UI isn't required (ISXB-1171)
if (editorRebuildMode == UIRebuildMode.None)
return;

UpdateView(state);
}

Expand Down Expand Up @@ -70,9 +74,9 @@ public void DestroyChildView<TView>(TView view) where TView : IView
view.DestroyView();
}

public void Dispatch(Command command)
public void Dispatch(Command command, UIRebuildMode editorRebuildMode = UIRebuildMode.Rebuild)
{
stateContainer.Dispatch(command);
stateContainer.Dispatch(command, editorRebuildMode);
}

public abstract void RedrawUI(TViewState viewState);
Expand Down
Loading