Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
bb38389
Added "swap controls" button to rebinding sample to allow swapping le…
ekcoh Sep 22, 2025
a66c819
Fixed a problem with previous swap bindings preventing multiple swaps…
ekcoh Sep 22, 2025
ba19e19
Improved RebindSaveLoad to allow reuse, added embryo of RebindBinding…
ekcoh Sep 23, 2025
c0720c1
Made load/save configurable on RebindSaveLoad component.
ekcoh Sep 23, 2025
76649d6
Refactoring of editor code, adding look sensitivity slider, added par…
ekcoh Sep 23, 2025
90f0b53
Simplified look sensitivity code
ekcoh Sep 24, 2025
8178b94
Generalized RebindActionParameterUI to make it possible to select par…
ekcoh Sep 25, 2025
0962b73
Removed hardcoded parameter names
ekcoh Sep 25, 2025
a579bfa
Fixed a problem which would cause mobile rebind sample build to run i…
ekcoh Sep 25, 2025
07161d9
Added rough on screen control that do not depend on UI
ekcoh Sep 26, 2025
b854395
Additional work on on screen controls including UI visualisation
ekcoh Sep 27, 2025
1bc2c53
Minor changes to on screen controls.
ekcoh Sep 27, 2025
96b7c1e
Fixed an issue where drag gesture wouldn't trigger directly when thre…
ekcoh Sep 28, 2025
d6ce1a0
Code cleanup
ekcoh Sep 28, 2025
54ccf57
Added inline doc
ekcoh Sep 28, 2025
59778c6
More work on onscreen controls.
ekcoh Sep 29, 2025
df6a2b8
Removed files that will be routed via other PRs
ekcoh Sep 29, 2025
e0a8e1e
Removed undesirable object from scene
ekcoh Sep 29, 2025
ccfd328
Removed meta file
ekcoh Sep 29, 2025
9276825
Undo changes not related to rebind sample extension.
ekcoh Oct 6, 2025
dd83145
Merge branch 'develop' into rebinding-sample-extension
ekcoh Oct 6, 2025
0bd8359
Updated changelog
ekcoh Oct 6, 2025
d1e17bb
Merge branch 'rebinding-sample-extension' of github.com:Unity-Technol…
ekcoh Oct 6, 2025
403e7d0
Slight improvements to README file
ekcoh Oct 6, 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
104 changes: 4 additions & 100 deletions Assets/Samples/RebindingUI/ActionLabelEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,38 +15,17 @@
{
protected void OnEnable()
{
m_ActionProperty = serializedObject.FindProperty("m_Action");
m_BindingIdProperty = serializedObject.FindProperty("m_BindingId");
m_BindingTextProperty = serializedObject.FindProperty("m_BindingText");
m_DisplayStringOptionsProperty = serializedObject.FindProperty("m_DisplayStringOptions");
m_UpdateBindingUIEventProperty = serializedObject.FindProperty("m_UpdateBindingUIEvent");

RefreshBindingOptions();
m_BindingUI = new BindingUI(serializedObject);

Check warning on line 20 in Assets/Samples/RebindingUI/ActionLabelEditor.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Assets/Samples/RebindingUI/ActionLabelEditor.cs#L20

Added line #L20 was not covered by tests
}

public override void OnInspectorGUI()
{
EditorGUI.BeginChangeCheck();

// Binding section.
EditorGUILayout.LabelField(m_BindingLabel, Styles.boldLabel);
using (new EditorGUI.IndentLevelScope())
{
EditorGUILayout.PropertyField(m_ActionProperty);

var newSelectedBinding = EditorGUILayout.Popup(m_BindingLabel, m_SelectedBindingOption, m_BindingOptions);
if (newSelectedBinding != m_SelectedBindingOption)
{
var bindingId = m_BindingOptionValues[newSelectedBinding];
m_BindingIdProperty.stringValue = bindingId;
m_SelectedBindingOption = newSelectedBinding;
}

var optionsOld = (InputBinding.DisplayStringOptions)m_DisplayStringOptionsProperty.intValue;
var optionsNew = (InputBinding.DisplayStringOptions)EditorGUILayout.EnumFlagsField(m_DisplayOptionsLabel, optionsOld);
if (optionsOld != optionsNew)
m_DisplayStringOptionsProperty.intValue = (int)optionsNew;
}
m_BindingUI.Draw();

Check warning on line 28 in Assets/Samples/RebindingUI/ActionLabelEditor.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Assets/Samples/RebindingUI/ActionLabelEditor.cs#L28

Added line #L28 was not covered by tests

// UI section.
EditorGUILayout.Space();
Expand All @@ -67,91 +46,16 @@
if (EditorGUI.EndChangeCheck())
{
serializedObject.ApplyModifiedProperties();
RefreshBindingOptions();
}
}

protected void RefreshBindingOptions()
{
var actionReference = (InputActionReference)m_ActionProperty.objectReferenceValue;
var action = actionReference?.action;

if (action == null)
{
m_BindingOptions = new GUIContent[0];
m_BindingOptionValues = new string[0];
m_SelectedBindingOption = -1;
return;
}

var bindings = action.bindings;
var bindingCount = bindings.Count;

m_BindingOptions = new GUIContent[bindingCount];
m_BindingOptionValues = new string[bindingCount];
m_SelectedBindingOption = -1;

var currentBindingId = m_BindingIdProperty.stringValue;
for (var i = 0; i < bindingCount; ++i)
{
var binding = bindings[i];
var bindingId = binding.id.ToString();
var haveBindingGroups = !string.IsNullOrEmpty(binding.groups);

// If we don't have a binding groups (control schemes), show the device that if there are, for example,
// there are two bindings with the display string "A", the user can see that one is for the keyboard
// and the other for the gamepad.
var displayOptions =
InputBinding.DisplayStringOptions.DontUseShortDisplayNames | InputBinding.DisplayStringOptions.IgnoreBindingOverrides;
if (!haveBindingGroups)
displayOptions |= InputBinding.DisplayStringOptions.DontOmitDevice;

// Create display string.
var displayString = action.GetBindingDisplayString(i, displayOptions);

// If binding is part of a composite, include the part name.
if (binding.isPartOfComposite)
displayString = $"{ObjectNames.NicifyVariableName(binding.name)}: {displayString}";

// Some composites use '/' as a separator. When used in popup, this will lead to to submenus. Prevent
// by instead using a backlash.
displayString = displayString.Replace('/', '\\');

// If the binding is part of control schemes, mention them.
if (haveBindingGroups)
{
var asset = action.actionMap?.asset;
if (asset != null)
{
var controlSchemes = string.Join(", ",
binding.groups.Split(InputBinding.Separator)
.Select(x => asset.controlSchemes.FirstOrDefault(c => c.bindingGroup == x).name));

displayString = $"{displayString} ({controlSchemes})";
}
}

m_BindingOptions[i] = new GUIContent(displayString);
m_BindingOptionValues[i] = bindingId;

if (currentBindingId == bindingId)
m_SelectedBindingOption = i;
m_BindingUI.Refresh();

Check warning on line 49 in Assets/Samples/RebindingUI/ActionLabelEditor.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Assets/Samples/RebindingUI/ActionLabelEditor.cs#L49

Added line #L49 was not covered by tests
}
}

private SerializedProperty m_ActionProperty;
private SerializedProperty m_BindingIdProperty;
private SerializedProperty m_BindingTextProperty;
private SerializedProperty m_UpdateBindingUIEventProperty;
private SerializedProperty m_DisplayStringOptionsProperty;

private GUIContent m_BindingLabel = new GUIContent("Binding");
private GUIContent m_DisplayOptionsLabel = new GUIContent("Display Options");
private GUIContent m_UILabel = new GUIContent("UI");
private GUIContent m_EventsLabel = new GUIContent("Events");
private GUIContent[] m_BindingOptions;
private string[] m_BindingOptionValues;
private int m_SelectedBindingOption;
private BindingUI m_BindingUI;

private static class Styles
{
Expand Down
5 changes: 4 additions & 1 deletion Assets/Samples/RebindingUI/Game/GameplayManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,9 @@

private void Awake()
{
// This game is designed for landscape orientation, so make sure we use it.
Screen.orientation = ScreenOrientation.LandscapeLeft;

Check warning on line 195 in Assets/Samples/RebindingUI/Game/GameplayManager.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Assets/Samples/RebindingUI/Game/GameplayManager.cs#L195

Added line #L195 was not covered by tests

m_FeedbackController = GetComponent<FeedbackController>();

m_EnemyPool = new ObjectPool<Enemy>(
Expand Down Expand Up @@ -256,7 +259,7 @@
--m_EnemySpawnCount;

// Rent an enemy from the enemy pool
var enemyComponent = m_EnemyPool.Get();
var enemyComponent = m_EnemyPool.Get(); // TODO Null reference here on domain reload

Check warning on line 262 in Assets/Samples/RebindingUI/Game/GameplayManager.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Assets/Samples/RebindingUI/Game/GameplayManager.cs#L262

Added line #L262 was not covered by tests

// Make the enemy spawn on border of visible game area
var orthoSize = gameCamera.orthographicSize;
Expand Down
24 changes: 24 additions & 0 deletions Assets/Samples/RebindingUI/InputActionExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System;

namespace UnityEngine.InputSystem.Samples.RebindUI
{
/// <summary>
/// Extension methods to reduce code bloat of this example.
/// </summary>
public static class InputActionExtensions
{
/// <summary>
/// Attempts to find an action binding using its binding ID (GUID).
/// </summary>
/// <param name="action">The action instance, may be null.</param>
/// <param name="bindingId">The binding ID (GUID) represented by a string.</param>
/// <returns>Zero-based index of the binding or -1 if not found.</returns>
public static int FindBindingById(this InputAction action, string bindingId)
{
if (action == null || string.IsNullOrEmpty(bindingId))
return -1;

Check warning on line 19 in Assets/Samples/RebindingUI/InputActionExtensions.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Assets/Samples/RebindingUI/InputActionExtensions.cs#L19

Added line #L19 was not covered by tests
var id = new Guid(bindingId);
return action.bindings.IndexOf(x => x.id == id);
}
}
}
3 changes: 3 additions & 0 deletions Assets/Samples/RebindingUI/InputActionExtensions.cs.meta

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

4 changes: 3 additions & 1 deletion Assets/Samples/RebindingUI/InputActionIndicator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@
private void OnEnable()
{
if (action != null && action.action != null)
action.action.performed += OnPerformed;
{
action.action.performed += OnPerformed; // TODO Problem here after domain reload, InputAction.addperformed(), CallbackArray.AddCallback,. InputArrayExtensions.Contains
}

Check warning on line 39 in Assets/Samples/RebindingUI/InputActionIndicator.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Assets/Samples/RebindingUI/InputActionIndicator.cs#L37-L39

Added lines #L37 - L39 were not covered by tests
}

private void OnDisable()
Expand Down
33 changes: 27 additions & 6 deletions Assets/Samples/RebindingUI/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,31 @@
This sample demonstrates how to use the Input System APIs to set up a rebinding UI. The main file is [RebindActionUI](./RebindActionUI.cs) which, aside from serving as an example, contains a reusable `MonoBehaviour` component for composing rebinding UIs. The [RebindUIPrefab](./RebindUIPrefab.prefab) contains a ready-made prefab that can be used as a simple drop-in setup for rebinding an individual action.
This sample demonstrates how to use the Input System APIs to set up a rebinding UI. The main file is
[RebindActionUI](./RebindActionUI.cs) which, aside from serving as an example, contains a reusable `MonoBehaviour`
component for composing rebinding UIs. The [RebindUIPrefab](./RebindUIPrefab.prefab) contains a ready-made prefab that
can be used as a simple drop-in setup for rebinding an individual action.

To demonstrate how to use images instead of textual display strings, take a look at [GamepadIconsExample](./GamepadIconsExample.cs).
To demonstrate how to use images instead of textual display strings, take a look at
[GamepadIconsExample](./GamepadIconsExample.cs).

To demonstrate how to show dynamic texts based on input action bindings, see [ActionLabel](./ActionLabel.cs).
To demonstrate how to show dynamic UI texts based on input action bindings, see [ActionLabel](./ActionLabel.cs).

Finally, the [RebindSaveLoad](./RebindSaveLoad.cs) script demonstrates how to persist user rebinds in `PlayerPrefs` and how to restore them from there.
[InputActionIndicator](./InputActionIndicator.cs) and [InputActionIndicator.prefab](./InputActionIndicator.prefab)
shows how to make a simple UI indicator that shows whether an associated input action is enabled, disabled or
performed. This behavior has been added to this sample to add observability of actions triggered within gameplay,
menu and rebind contexts.

The icons used in the sample are taken from [Free Prompts Pack v4.0](https://opengameart.org/content/free-keyboard-and-controllers-prompts-pack) created by, and made available to public domain by Nicolae Berbece.
Icons are licensed under [Creative Commons CC0](https://creativecommons.org/publicdomain/zero/1.0/).
The [RebindSaveLoad](./RebindSaveLoad.cs) script demonstrates how to persist user rebinds in `PlayerPrefs` and how
to restore them.

In this sample, keyboard bindings for "Move" (default WASD) is rebound as a single composite. This means that
indivudual parts will get assigned one after the other. Another way of doing this is to set it up as four individual
button bindings and assign them individually as four partial bindings.

In this sample it is possible to directly rebind gamepad sticks in the gamepad control scheme. In practice, you
probably don't want to set up rebinding the sticks like this but rather have a "swap sticks" kind of toggle instead.
In this sample we have both variants for demonstration purposes. See [RebindActionUI.SwapBinding](./RebindActionUI.cs)
for a method that swaps two bindings of similar type.

The icons used in the sample are taken from
[Free Prompts Pack v4.0](https://opengameart.org/content/free-keyboard-and-controllers-prompts-pack) created by,
and made available to public domain by Nicolae Berbece.
Icons are licensed under [Creative Commons CC0](https://creativecommons.org/publicdomain/zero/1.0/).
146 changes: 146 additions & 0 deletions Assets/Samples/RebindingUI/RebindActionEditor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
#if UNITY_EDITOR

using System;
using System.Linq;
using UnityEditor;

namespace UnityEngine.InputSystem.Samples.RebindUI
{
/// <summary>
/// Common binding UI helper to allow editor composition.
/// </summary>
internal class BindingUI
{
private readonly SerializedProperty m_ActionProperty;
private readonly SerializedProperty m_BindingIdProperty;
private readonly SerializedProperty m_DisplayStringOptionsProperty;

public BindingUI(SerializedObject serializedObject)
: this(serializedObject.FindProperty("m_Action"), serializedObject.FindProperty("m_BindingId"),

Check warning on line 19 in Assets/Samples/RebindingUI/RebindActionEditor.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Assets/Samples/RebindingUI/RebindActionEditor.cs#L19

Added line #L19 was not covered by tests
serializedObject.FindProperty("m_DisplayStringOptions"))
{}

Check warning on line 21 in Assets/Samples/RebindingUI/RebindActionEditor.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Assets/Samples/RebindingUI/RebindActionEditor.cs#L21

Added line #L21 was not covered by tests

public BindingUI(SerializedProperty actionProperty, SerializedProperty bindingIdProperty,

Check warning on line 23 in Assets/Samples/RebindingUI/RebindActionEditor.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Assets/Samples/RebindingUI/RebindActionEditor.cs#L23

Added line #L23 was not covered by tests
SerializedProperty displayStringOptionsProperty = null)
{
m_ActionProperty = actionProperty;
m_BindingIdProperty = bindingIdProperty;
m_DisplayStringOptionsProperty = displayStringOptionsProperty;

Check warning on line 28 in Assets/Samples/RebindingUI/RebindActionEditor.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Assets/Samples/RebindingUI/RebindActionEditor.cs#L25-L28

Added lines #L25 - L28 were not covered by tests

Reset();
Refresh();
}

Check warning on line 32 in Assets/Samples/RebindingUI/RebindActionEditor.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Assets/Samples/RebindingUI/RebindActionEditor.cs#L30-L32

Added lines #L30 - L32 were not covered by tests

private void Reset()
{
bindingOptions = Array.Empty<GUIContent>();
bindingOptionValues = Array.Empty<string>();
selectedBindingIndex = -1;
}

Check warning on line 39 in Assets/Samples/RebindingUI/RebindActionEditor.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Assets/Samples/RebindingUI/RebindActionEditor.cs#L35-L39

Added lines #L35 - L39 were not covered by tests

public void Draw()
{

Check warning on line 42 in Assets/Samples/RebindingUI/RebindActionEditor.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Assets/Samples/RebindingUI/RebindActionEditor.cs#L42

Added line #L42 was not covered by tests
// Binding section.
EditorGUILayout.LabelField(m_BindingLabel);
using (new EditorGUI.IndentLevelScope())
{
EditorGUILayout.PropertyField(m_ActionProperty);

Check warning on line 47 in Assets/Samples/RebindingUI/RebindActionEditor.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Assets/Samples/RebindingUI/RebindActionEditor.cs#L44-L47

Added lines #L44 - L47 were not covered by tests

var newSelectedBinding = EditorGUILayout.Popup(m_BindingLabel, selectedBindingIndex, bindingOptions);
if (newSelectedBinding != selectedBindingIndex)
{
var bindingId = bindingOptionValues[newSelectedBinding];
m_BindingIdProperty.stringValue = bindingId;
selectedBindingIndex = newSelectedBinding;
}

Check warning on line 55 in Assets/Samples/RebindingUI/RebindActionEditor.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Assets/Samples/RebindingUI/RebindActionEditor.cs#L49-L55

Added lines #L49 - L55 were not covered by tests

if (m_DisplayStringOptionsProperty != null)
{
var optionsOld = (InputBinding.DisplayStringOptions)m_DisplayStringOptionsProperty.intValue;
var optionsNew = (InputBinding.DisplayStringOptions)EditorGUILayout.EnumFlagsField(m_DisplayOptionsLabel, optionsOld);
if (optionsOld != optionsNew)
m_DisplayStringOptionsProperty.intValue = (int)optionsNew;
}
}
}

Check warning on line 65 in Assets/Samples/RebindingUI/RebindActionEditor.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Assets/Samples/RebindingUI/RebindActionEditor.cs#L57-L65

Added lines #L57 - L65 were not covered by tests

public bool Refresh()
{
if (action == null)
{
Reset();
return false;

Check warning on line 72 in Assets/Samples/RebindingUI/RebindActionEditor.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Assets/Samples/RebindingUI/RebindActionEditor.cs#L68-L72

Added lines #L68 - L72 were not covered by tests
}

var bindings = action.bindings;
var bindingCount = bindings.Count;

Check warning on line 76 in Assets/Samples/RebindingUI/RebindActionEditor.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Assets/Samples/RebindingUI/RebindActionEditor.cs#L75-L76

Added lines #L75 - L76 were not covered by tests

bindingOptions = new GUIContent[bindingCount];
bindingOptionValues = new string[bindingCount];
selectedBindingIndex = -1;

Check warning on line 80 in Assets/Samples/RebindingUI/RebindActionEditor.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Assets/Samples/RebindingUI/RebindActionEditor.cs#L78-L80

Added lines #L78 - L80 were not covered by tests

var currentBindingId = m_BindingIdProperty.stringValue;
for (var i = 0; i < bindingCount; ++i)
{
var binding = bindings[i];
var bindingId = binding.id.ToString();
var haveBindingGroups = !string.IsNullOrEmpty(binding.groups);

Check warning on line 87 in Assets/Samples/RebindingUI/RebindActionEditor.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Assets/Samples/RebindingUI/RebindActionEditor.cs#L82-L87

Added lines #L82 - L87 were not covered by tests

// If we don't have a binding groups (control schemes), show the device that if there are, for example,
// there are two bindings with the display string "A", the user can see that one is for the keyboard
// and the other for the gamepad.
var displayOptions =

Check warning on line 92 in Assets/Samples/RebindingUI/RebindActionEditor.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Assets/Samples/RebindingUI/RebindActionEditor.cs#L92

Added line #L92 was not covered by tests
InputBinding.DisplayStringOptions.DontUseShortDisplayNames | InputBinding.DisplayStringOptions.IgnoreBindingOverrides;
if (!haveBindingGroups)
displayOptions |= InputBinding.DisplayStringOptions.DontOmitDevice;

Check warning on line 95 in Assets/Samples/RebindingUI/RebindActionEditor.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Assets/Samples/RebindingUI/RebindActionEditor.cs#L94-L95

Added lines #L94 - L95 were not covered by tests

// Create display string.
var displayString = action.GetBindingDisplayString(i, displayOptions);

Check warning on line 98 in Assets/Samples/RebindingUI/RebindActionEditor.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Assets/Samples/RebindingUI/RebindActionEditor.cs#L98

Added line #L98 was not covered by tests

// If binding is part of a composite, include the part name.
if (binding.isPartOfComposite)
displayString = $"{ObjectNames.NicifyVariableName(binding.name)}: {displayString}";

Check warning on line 102 in Assets/Samples/RebindingUI/RebindActionEditor.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Assets/Samples/RebindingUI/RebindActionEditor.cs#L101-L102

Added lines #L101 - L102 were not covered by tests

// Some composites use '/' as a separator. When used in popup, this will lead to to submenus. Prevent
// by instead using a backlash.
displayString = displayString.Replace('/', '\\');

Check warning on line 106 in Assets/Samples/RebindingUI/RebindActionEditor.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Assets/Samples/RebindingUI/RebindActionEditor.cs#L106

Added line #L106 was not covered by tests

// If the binding is part of control schemes, mention them.
if (haveBindingGroups)
{
var asset = action.actionMap?.asset;
if (asset != null)
{
var controlSchemes = string.Join(", ",

Check warning on line 114 in Assets/Samples/RebindingUI/RebindActionEditor.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Assets/Samples/RebindingUI/RebindActionEditor.cs#L109-L114

Added lines #L109 - L114 were not covered by tests
binding.groups.Split(InputBinding.Separator)
.Select(x => asset.controlSchemes.FirstOrDefault(c => c.bindingGroup == x).name));

Check warning on line 116 in Assets/Samples/RebindingUI/RebindActionEditor.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Assets/Samples/RebindingUI/RebindActionEditor.cs#L116

Added line #L116 was not covered by tests

displayString = $"{displayString} ({controlSchemes})";
}
}

Check warning on line 120 in Assets/Samples/RebindingUI/RebindActionEditor.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Assets/Samples/RebindingUI/RebindActionEditor.cs#L118-L120

Added lines #L118 - L120 were not covered by tests

bindingOptions[i] = new GUIContent(displayString);
bindingOptionValues[i] = bindingId;

Check warning on line 123 in Assets/Samples/RebindingUI/RebindActionEditor.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Assets/Samples/RebindingUI/RebindActionEditor.cs#L122-L123

Added lines #L122 - L123 were not covered by tests

if (currentBindingId == bindingId)
selectedBindingIndex = i;
}

Check warning on line 127 in Assets/Samples/RebindingUI/RebindActionEditor.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Assets/Samples/RebindingUI/RebindActionEditor.cs#L125-L127

Added lines #L125 - L127 were not covered by tests

return true;
}

Check warning on line 130 in Assets/Samples/RebindingUI/RebindActionEditor.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Assets/Samples/RebindingUI/RebindActionEditor.cs#L129-L130

Added lines #L129 - L130 were not covered by tests

public string bindingId => m_BindingIdProperty.stringValue;
public int bindingIndex => action.FindBindingById(m_BindingIdProperty.stringValue);

Check warning on line 133 in Assets/Samples/RebindingUI/RebindActionEditor.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Assets/Samples/RebindingUI/RebindActionEditor.cs#L132-L133

Added lines #L132 - L133 were not covered by tests

public InputAction action => ((InputActionReference)m_ActionProperty.objectReferenceValue)?.action;

Check warning on line 135 in Assets/Samples/RebindingUI/RebindActionEditor.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Assets/Samples/RebindingUI/RebindActionEditor.cs#L135

Added line #L135 was not covered by tests

private GUIContent[] bindingOptions { get; set; }
private string[] bindingOptionValues { get; set; }
private int selectedBindingIndex { get; set; }

Check warning on line 139 in Assets/Samples/RebindingUI/RebindActionEditor.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Assets/Samples/RebindingUI/RebindActionEditor.cs#L137-L139

Added lines #L137 - L139 were not covered by tests

private readonly GUIContent m_BindingLabel = new GUIContent("Binding");
private readonly GUIContent m_DisplayOptionsLabel = new GUIContent("Display Options");

Check warning on line 142 in Assets/Samples/RebindingUI/RebindActionEditor.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Assets/Samples/RebindingUI/RebindActionEditor.cs#L141-L142

Added lines #L141 - L142 were not covered by tests
}
}

#endif // UNITY_EDITOR
3 changes: 3 additions & 0 deletions Assets/Samples/RebindingUI/RebindActionEditor.cs.meta

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

Loading
Loading