Skip to content

Commit 3f4d780

Browse files
ekcohAlexTyrerPauliusd01
authored
CHANGE: ISX-1901, ISX-1520: Project-wide actions assignment only assignable in edit-mode (#1866)
* FIX: Removed explicit enable of project-wide actions from example. This should be guaranteed by API contract of InputSystem.actions. * FIX: Disabled dialogs in tests. Added proper play-mode and player test suites for Project wide actions which required some refactoring. Renamed InputTestFixture.Setup to SetUp to not collide with UTF framework interfaces. * FIX: Fixed ProjectWideInputActionsEditorTests so that it doesn't have side-effects on users configuration of InputSystem.actions or Asset folder files. * FIX: Fixed incorrect test case assuming project-wide actions would be enabled in edit mode. Now correctly compensate after entering play mode for the specific scenario. * FIX: Adjustments to existing test cases for edit-mode, editor play-mode, player play-mode and additional tests. * FIX: Updated InputForUITests to work with preloaded asset. Updated CoreTests_ProjectWideActions to utilise editor build settings to preserve user configuration. * FIX: Removed an assert that would generate an error in builds. Instead check if asset to be included as preloaded asset is null and skip including it if that is the case. * FIX: Disallow reassigning InputSystem.actions in editor during play-mode to prevent exception from being thrown when attempting to do so. --------- Co-authored-by: Alex Tyrer <[email protected]> Co-authored-by: Paulius Dervinis <[email protected]>
1 parent de8c453 commit 3f4d780

29 files changed

+1013
-623
lines changed

Assets/Samples/ProjectWideActions/ProjectWideActionsExample.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,6 @@ void Start()
3131
previous = InputSystem.actions.FindAction("Player/Previous");
3232
sprint = InputSystem.actions.FindAction("Player/Sprint");
3333
crouch = InputSystem.actions.FindAction("Player/Crouch");
34-
35-
if (!InputSystem.actions.enabled)
36-
{
37-
Debug.Log("Project Wide Input Actions should be enabled by default by Unity but they are not - enabling to make sure the input works");
38-
InputSystem.actions.Enable();
39-
}
4034
}
4135
else
4236
{

Assets/Tests/InputSystem.Editor/ControlSchemeEditorTests.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,24 @@
11
#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS
22
using NUnit.Framework;
3-
using UnityEngine;
43
using UnityEngine.InputSystem;
54
using UnityEngine.InputSystem.Editor;
65
using System;
76
using System.Text.RegularExpressions;
87

98
public class ControlSchemesEditorTests
109
{
10+
[SetUp]
11+
public void SetUp()
12+
{
13+
TestUtils.MockDialogs();
14+
}
15+
16+
[TearDown]
17+
public void TearDown()
18+
{
19+
TestUtils.RestoreDialogs();
20+
}
21+
1122
[Test]
1223
[Category("AssetEditor")]
1324
public void AddRequirementCommand_AddsDeviceRequirements()

0 commit comments

Comments
 (0)