Skip to content
Open
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
27 changes: 27 additions & 0 deletions Assets/Tests/InputSystem/Plugins/InputForUITests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,33 @@ public void InputSystemActionAssetIsNotNull()
"Test is invalid since InputSystemProvider actions are not available");
}

[Test]
[Category(kTestCategory)]
public void Shutdown_DoesNotDisableProjectWideActionsAsset()
{
var asset = ScriptableObject.CreateInstance<InputActionAsset>();
var uiMap = new InputActionMap("UI");
uiMap.AddAction("Point", InputActionType.PassThrough, "<Mouse>/position");
uiMap.AddAction("Navigate", InputActionType.PassThrough, "<Gamepad>/leftStick");
uiMap.AddAction("Submit", InputActionType.Button, "<Keyboard>/enter");
uiMap.AddAction("Cancel", InputActionType.Button, "<Keyboard>/escape");
uiMap.AddAction("Click", InputActionType.PassThrough, "<Mouse>/leftButton");
uiMap.AddAction("MiddleClick", InputActionType.PassThrough, "<Mouse>/middleButton");
uiMap.AddAction("RightClick", InputActionType.PassThrough, "<Mouse>/rightButton");
uiMap.AddAction("ScrollWheel", InputActionType.PassThrough, "<Mouse>/scroll");
asset.AddActionMap(uiMap);

InputSystem.s_Manager.actions = asset;

m_InputSystemProvider.Initialize();
Assert.That(asset.enabled, Is.True, "Project-wide actions should be enabled by provider initialization.");

m_InputSystemProvider.Shutdown();
Assert.That(asset.enabled, Is.True, "Project-wide actions must remain enabled after provider shutdown.");

Object.DestroyImmediate(asset);
}

[Test]
[Category(kTestCategory)]
// Checks that mouse events are ignored when a touch is active.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@ void UnregisterActions()
UnregisterAction(ref m_RightClickAction, OnRightClickPerformed);
UnregisterAction(ref m_ScrollWheelAction, OnScrollWheelPerformed);

if (m_InputActionAsset != null)
if (m_InputActionAsset != null && m_InputActionAsset != InputSystem.actions)
m_InputActionAsset.Disable();
}

Expand Down