Skip to content

NEW: (ISXB-1524, ISX-2325, revisiting ISXB-1396) Fix for rebinding issues related to incorrect event suppression + Changed Rebinding Sample #2168

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 60 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
e5509ff
Debug files
ekcoh Apr 9, 2025
58ee7a8
Merge branch 'develop' into ekcoh/rebinding-issues-events
ekcoh Apr 14, 2025
d323b9b
Added debug script to scene
ekcoh Apr 14, 2025
da35c49
Added wait to RebindActionUI.cs
ekcoh Apr 15, 2025
93de642
Added input event handled policy run-time setting
ekcoh Apr 22, 2025
59b2659
wip
ekcoh Apr 23, 2025
e4e57cf
Modified handled evaluation in state monitors. Formatting.
ekcoh Apr 23, 2025
00abdcf
Renamed variable
ekcoh Apr 23, 2025
9bdd2d2
Refactoring of names
ekcoh Apr 23, 2025
71e7b61
Updated rebinding UI sample to use new feature (handling policy)
ekcoh Apr 23, 2025
b50d660
Undo of previous change
ekcoh Apr 23, 2025
9c6b2d8
Undo previous change
ekcoh Apr 23, 2025
2d195ed
Made input manager property internal for now
ekcoh Apr 23, 2025
f9c61f5
Attempt to fix xml syntax error for doc
ekcoh Apr 23, 2025
10d2579
Updated changelog
ekcoh Apr 23, 2025
21bd4a8
Merge branch 'develop' into ekcoh/rebinding-issues-events
ekcoh Apr 24, 2025
edbdbcf
Removed ActionDebug script from branch
ekcoh Apr 24, 2025
1baba6c
Undo changes to UI sample actions
ekcoh Apr 24, 2025
b7d8a10
Removed debug comments
ekcoh Apr 24, 2025
69aa686
Formatting
ekcoh Apr 24, 2025
7d07d89
Undo debug comment
ekcoh Apr 24, 2025
eed66dc
Further tweaks of logic
ekcoh Apr 24, 2025
3dfda93
Merge branch 'develop' into ekcoh/rebinding-issues-events
ekcoh Apr 28, 2025
c39c1c0
Fixed formatting
ekcoh Apr 28, 2025
97b41f9
Merge branch 'ekcoh/rebinding-issues-events' of github.com:Unity-Tech…
ekcoh Apr 28, 2025
b82cf28
Expanded Rebinding example to show how actions fire in relation to input
ekcoh Jun 18, 2025
d1932d5
Merge branch 'develop' into ekcoh/rebinding-issues-events
ekcoh Jun 18, 2025
3ad7c58
Improvements to rebinding sample to increase visibility of potential …
ekcoh Jun 24, 2025
200b123
Minor changes to sample scene, added delta rebind
ekcoh Jun 24, 2025
85c8023
Merge branch 'develop' into ekcoh/rebinding-issues-events
ekcoh Jun 24, 2025
74ef71a
Updated CHANGELOG.md
ekcoh Jun 24, 2025
eaa9295
Removed policy property from InputSystem and made the enum type inter…
ekcoh Jun 24, 2025
3191c2e
Reformatted files
ekcoh Jun 24, 2025
8500e3e
Minor tweaks to sample, expanded test coverage, temporary avoid deser…
ekcoh Jun 25, 2025
ca3e1cc
Renamed files, converted action indicators to prefabs and replaced th…
ekcoh Jun 25, 2025
90a9a24
Tweaks to sample, adding missing namespace, changed game manager to u…
ekcoh Jun 25, 2025
40771cb
Clean-up of rebinding sample
ekcoh Jun 25, 2025
af8ad8b
Cleanup of rebinding sample
ekcoh Jun 25, 2025
f3fb1f7
Formatting
ekcoh Jun 25, 2025
f98f4ec
Minor tweaks to rebinding sample and added support for showing disabl…
ekcoh Jun 25, 2025
0a39dd7
Remove code explicitly disabling UI map from rebinding sample since i…
ekcoh Jun 25, 2025
93c7942
Formatting
ekcoh Jun 25, 2025
20e6920
Removed debug script
ekcoh Jun 25, 2025
1e95882
Restored deserialization of setting
ekcoh Jun 25, 2025
87a5590
Removed obsolete editor code and simplified game manager
ekcoh Jun 25, 2025
211bd8a
Removed TODO
ekcoh Jun 25, 2025
f82d27a
Merge branch 'develop' into ekcoh/rebinding-issues-events
ekcoh Jun 25, 2025
abcfe77
Added timeout to example to make sure a user do not get stuck, if e.g…
ekcoh Jun 25, 2025
cbdbe1c
Merge branch 'ekcoh/rebinding-issues-events' of github.com:Unity-Tech…
ekcoh Jun 25, 2025
b21c51a
Version bump to 1.15.0
ekcoh Jun 25, 2025
7b1a080
Version bump generated files
ekcoh Jun 25, 2025
332e90b
Fixed xmldoc referencing internal types.
ekcoh Jun 26, 2025
216d7fe
Merge branch 'develop' into ekcoh/rebinding-issues-events
ekcoh Jun 26, 2025
538127f
Added support for suppressing any kind of state event during rebindin…
ekcoh Jun 26, 2025
1f0514c
Merge branch 'ekcoh/rebinding-issues-events' of github.com:Unity-Tech…
ekcoh Jun 26, 2025
b5272cd
Added missing namespace to RebindSaveLoad
ekcoh Jun 26, 2025
1ba9dba
Temporarily disabled new function of suppressing non-matched input, i…
ekcoh Jun 26, 2025
7885737
Added ability to also reset all bindings
ekcoh Jun 26, 2025
baf6180
Tweaked UI to also render correctly on 16:10, e.g. WebGL
ekcoh Jun 26, 2025
980abc0
Fixed a bug where selection wouldn't be restored if cancelling rebind…
ekcoh Jun 26, 2025
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
2 changes: 1 addition & 1 deletion Assets/Samples/InGameHints/InGameHintsActions.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator
// version 1.14.1
// version 1.15.0
// from Assets/Samples/InGameHints/InGameHintsActions.inputactions
//
// Changes to this file may cause incorrect behavior and will be lost if
Expand Down
47 changes: 47 additions & 0 deletions Assets/Samples/RebindingUI/CanvasGroupModifier.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
using UnityEngine.EventSystems;

namespace UnityEngine.InputSystem.Samples.RebindUI
{
/// <summary>
/// Simple utility that modifies a referenced CanvasGroup while being active.
/// </summary>
public class CanvasGroupModifier : MonoBehaviour
{
[Tooltip("The Canvas Group to be modified while this component is active")]
public CanvasGroup canvasGroup;

[Tooltip("The interactable setting to use for the Canvas Group while this component is active")]
public bool interactable = false;

private bool m_SavedInteractable;
private GameObject m_SelectedObject;

void OnEnable()
{
if (canvasGroup != null)
{
// Store selection to make sure it is not changed when switching "windows".
m_SelectedObject = EventSystem.current.currentSelectedGameObject;

// Save current setting and override
m_SavedInteractable = canvasGroup.interactable;
canvasGroup.interactable = interactable;
}
}

void OnDisable()
{
if (canvasGroup != null)
{
// Restore previous setting.
canvasGroup.interactable = m_SavedInteractable;

// Restore previous selection.
if (m_SelectedObject != null)
EventSystem.current.SetSelectedGameObject(m_SelectedObject);
else if (EventSystem.current.currentSelectedGameObject == null)
EventSystem.current.SetSelectedGameObject(EventSystem.current.firstSelectedGameObject);
}
}
}
}
2 changes: 2 additions & 0 deletions Assets/Samples/RebindingUI/CanvasGroupModifier.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

95 changes: 95 additions & 0 deletions Assets/Samples/RebindingUI/InputActionIndicator.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
using System;
using UnityEngine.UI;

namespace UnityEngine.InputSystem.Samples.RebindUI
{
/// <summary>
/// A simple visual indicator of action performed.
/// </summary>
/// <remarks>Error handling have been excluded for simplicity.</remarks>
[RequireComponent(typeof(Image))]
public class InputActionIndicator : MonoBehaviour
{
[Tooltip("Reference to the associated action to be visualized.")]
public InputActionReference action;

[Tooltip("The color to show when the associated action is performed.")]
public Color activeColor = Color.green;

[Tooltip("The color to show when the associated action has not been performed for the specified duration.")]
public Color inactiveColor = Color.black;

[Tooltip("The color to show when the associated action is disabled")]
public Color disabledColor = Color.red;

[Tooltip("The duration for which the indicator should be lit before becoming completely inactive.")]
public float duration = 1.0f;

private double m_RealTimeLastPerformed;
private Image m_Image;
private Text m_Text;

void Awake()
{
m_Image = GetComponent<Image>();
m_Text = GetComponent<Text>();
Update();
}

private void OnEnable()
{
action.action.performed += OnPerformed;
action.action.Enable();
}

private void OnDisable()
{
action.action.Disable();
action.action.performed -= OnPerformed;
}

private void OnPerformed(InputAction.CallbackContext obj)
{
m_RealTimeLastPerformed = Time.realtimeSinceStartupAsDouble;
}

private void Update()
{
if (action.action.enabled)
{
// Pulse active color if enabled
var elapsedSincePerformed = Time.realtimeSinceStartupAsDouble - m_RealTimeLastPerformed;
m_Image.color = duration <= 0.0f
? inactiveColor
: Color.Lerp(inactiveColor, activeColor,
(float)Math.Max(0.0, 1.0 - elapsedSincePerformed / duration));
}
else
{
// Show disabled indicator if disabled
if (m_Image.color != disabledColor)
m_Image.color = disabledColor;
}
}

// We want the label for the action name to update in edit mode, too, so
// we kick that off from here.
#if UNITY_EDITOR
protected void OnValidate()
{
UpdateActionLabel();
}

#endif

private void UpdateActionLabel()
{
if (m_Text == null)
return;
if (action != null && action.action != null)
m_Text.text = action.name;
else
m_Text.text = string.Empty;
}
}
}
2 changes: 2 additions & 0 deletions Assets/Samples/RebindingUI/InputActionIndicator.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

174 changes: 174 additions & 0 deletions Assets/Samples/RebindingUI/InputActionIndicator.prefab
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &1255350527062619510
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1777307397533242038}
- component: {fileID: 1780074258963799934}
- component: {fileID: 4442569273011091735}
- component: {fileID: 8586258032687207620}
m_Layer: 5
m_Name: InputActionIndicator
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1777307397533242038
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1255350527062619510}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 943689430639722906}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0}
m_AnchorMax: {x: 0.5, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 30, y: 30}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &1780074258963799934
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1255350527062619510}
m_CullTransparentMesh: 1
--- !u!114 &4442569273011091735
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1255350527062619510}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0, g: 1, b: 0.19607843, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 10913, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!114 &8586258032687207620
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1255350527062619510}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b5c8f13dfafeb5445b872565802d1e44, type: 3}
m_Name:
m_EditorClassIdentifier:
action: {fileID: 0}
activeColor: {r: 0, g: 1, b: 0, a: 1}
inactiveColor: {r: 0, g: 0, b: 0, a: 1}
duration: 1
--- !u!1 &5827664391383982697
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 943689430639722906}
- component: {fileID: 6561043267186049780}
- component: {fileID: 4072204658071074964}
m_Layer: 5
m_Name: Label
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &943689430639722906
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5827664391383982697}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1777307397533242038}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0}
m_AnchorMax: {x: 0.5, y: 0}
m_AnchoredPosition: {x: 0, y: 45.000015}
m_SizeDelta: {x: 103.7, y: 30}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &6561043267186049780
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5827664391383982697}
m_CullTransparentMesh: 0
--- !u!114 &4072204658071074964
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5827664391383982697}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 16
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 1
m_MaxSize: 40
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: Indicator
7 changes: 7 additions & 0 deletions Assets/Samples/RebindingUI/InputActionIndicator.prefab.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 35 additions & 0 deletions Assets/Samples/RebindingUI/InvokeUnityEvent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using UnityEngine.Events;

namespace UnityEngine.InputSystem.Samples.RebindUI
{
/// <summary>
/// A simple component that deactivates a target when action is performed.
/// </summary>
public class InvokeUnityEvent : MonoBehaviour
{
[Tooltip("The input action that triggers the Unity event when performed.")]
public InputActionReference action;

[Tooltip("The Unity event to be invoked when action is performed.")]
public UnityEvent onPerformed;

private void OnEnable()
{
// Register callback when component is enabled
if (action != null && action.action != null)
action.action.performed += OnActionPerformed;
}

private void OnDisable()
{
// Unregister callback when component is disabled
if (action != null && action.action != null)
action.action.performed -= OnActionPerformed;
}

private void OnActionPerformed(InputAction.CallbackContext context)
{
onPerformed?.Invoke();
}
}
}
2 changes: 2 additions & 0 deletions Assets/Samples/RebindingUI/InvokeUnityEvent.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading