Skip to content

Commit aa19430

Browse files
committed
Add inspector warning when PWA are used in PlayerInput
1 parent 306f466 commit aa19430

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

Packages/com.unity.inputsystem/InputSystem/Plugins/PlayerInput/PlayerInputEditor.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,20 @@ public override void OnInspectorGUI()
8080
EditorGUI.BeginChangeCheck();
8181
EditorGUILayout.PropertyField(m_ActionsProperty);
8282
var actionsWereChanged = false;
83+
84+
if (m_ActionsProperty.objectReferenceValue != null)
85+
{
86+
InputActionAsset actions = m_ActionsProperty.objectReferenceValue as InputActionAsset;
87+
// Check for if we're using project-wide actions to raise warning
88+
if (actions == InputSystem.actions)
89+
{
90+
EditorGUILayout.HelpBox("Project-Wide Actions should not used with Player Input because it's a " +
91+
"singleton reference and all actions maps are enabled by default.\r\n" +
92+
"If you choose to do so in Single Player, please disable all action maps on Start() and " +
93+
"manually enable the ones needed.", MessageType.Warning);
94+
}
95+
}
96+
8397
if (EditorGUI.EndChangeCheck() || !m_ActionAssetInitialized || CheckIfActionAssetChanged())
8498
{
8599
OnActionAssetChange();
@@ -120,7 +134,6 @@ public override void OnInspectorGUI()
120134
// Restore the initial color
121135
GUI.backgroundColor = currentBg;
122136

123-
124137
rect = EditorGUILayout.GetControlRect();
125138
label = EditorGUI.BeginProperty(rect, m_AutoSwitchText, m_NeverAutoSwitchControlSchemesProperty);
126139
var neverAutoSwitchValueOld = m_NeverAutoSwitchControlSchemesProperty.boolValue;

0 commit comments

Comments
 (0)