Skip to content

Commit

Permalink
Fixed inspector of PlayerInput component to handle prefabs
Browse files Browse the repository at this point in the history
  • Loading branch information
bmalrat committed May 24, 2024
1 parent 453e55a commit 947c367
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Packages/com.unity.inputsystem/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ however, it has to be formatted properly to pass verification tests.
- Fixed an issue where a composite binding would not be consecutively triggered after ResetDevice() has been called from the associated action handler [ISXB-746](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-746).
- Fixed resource designation for "d_InputControl" icon to address CI failure.
- Fixed an issue where a composite binding would not be consecutively triggered after disabling actions while there are action modifiers in progress [ISXB-505](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-505).
- Fixed Missing default control scheme used by PlayerInput component are now correctly shown in the inspector [ISXB-818](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-818)
- Fixed prefabs and missing default control scheme used by PlayerInput component are now correctly shown in the inspector [ISXB-818](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-818)

## [1.8.2] - 2024-04-29

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,11 @@ public override void OnInspectorGUI()
// if the invalid DefaultControlSchemeName is selected set the popup draw the BG color in red
if (m_InvalidDefaultControlSchemeName != null && m_SelectedDefaultControlScheme == 1)
GUI.backgroundColor = Color.red;
var selected = EditorGUILayout.Popup(m_DefaultControlSchemeText, m_SelectedDefaultControlScheme,
m_ControlSchemeOptions);

var rect = EditorGUILayout.GetControlRect();
var label = EditorGUI.BeginProperty(rect, m_DefaultControlSchemeText, m_DefaultControlSchemeProperty);
var selected = EditorGUI.Popup(rect, label, m_SelectedDefaultControlScheme, m_ControlSchemeOptions);
EditorGUI.EndProperty();
if (selected != m_SelectedDefaultControlScheme)
{
if (selected == 0)
Expand All @@ -111,8 +114,12 @@ public override void OnInspectorGUI()
// Restore the initial color
GUI.backgroundColor = currentBg;


rect = EditorGUILayout.GetControlRect();
label = EditorGUI.BeginProperty(rect, m_AutoSwitchText, m_NeverAutoSwitchControlSchemesProperty);
var neverAutoSwitchValueOld = m_NeverAutoSwitchControlSchemesProperty.boolValue;
var neverAutoSwitchValueNew = !EditorGUILayout.Toggle(m_AutoSwitchText, !neverAutoSwitchValueOld);
var neverAutoSwitchValueNew = !EditorGUI.Toggle(rect, label, !neverAutoSwitchValueOld);
EditorGUI.EndProperty();
if (neverAutoSwitchValueOld != neverAutoSwitchValueNew)
{
m_NeverAutoSwitchControlSchemesProperty.boolValue = neverAutoSwitchValueNew;
Expand All @@ -122,9 +129,11 @@ public override void OnInspectorGUI()
if (m_ActionMapOptions != null && m_ActionMapOptions.Length > 0)
{
// Default action map picker.

var selected = EditorGUILayout.Popup(m_DefaultActionMapText, m_SelectedDefaultActionMap,
var rect = EditorGUILayout.GetControlRect();
var label = EditorGUI.BeginProperty(rect, m_DefaultActionMapText, m_DefaultActionMapProperty);
var selected = EditorGUI.Popup(rect, label, m_SelectedDefaultActionMap,
m_ActionMapOptions);
EditorGUI.EndProperty();
if (selected != m_SelectedDefaultActionMap)
{
if (selected == 0)
Expand Down

0 comments on commit 947c367

Please sign in to comment.