Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CHANGE: ISX-1865 Switch from InputManager.asset to asset-based storage for Project-wide actions #1834

Merged
merged 55 commits into from
Feb 18, 2024
Merged
Show file tree
Hide file tree
Changes from 46 commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
85c5cf7
Replacing use of Inputmanager.asset with promoted InputActionsAsset
ekcoh Feb 5, 2024
66a8f3a
WIP: More changes towards asset based workflow
ekcoh Feb 7, 2024
879857d
Fixes to allow to compile
lyndon-unity Feb 8, 2024
5aba932
Improved UX for the project wide input actions in project settings
lyndon-unity Feb 9, 2024
8182b37
Added missing changes for UX updates
lyndon-unity Feb 9, 2024
b09d43b
Added indication of selected project wide input actions asset
lyndon-unity Feb 9, 2024
ee24377
Enabled reset button to work on project wide input assets
lyndon-unity Feb 9, 2024
92b2f30
Fixes for package to load in 2019
lyndon-unity Feb 9, 2024
b17423e
Fixed asset import
lyndon-unity Feb 9, 2024
2a5078f
Fixed Editor_LeavingPlayMode_DestroysAllActionStates test for when In…
lyndon-unity Feb 9, 2024
7abb437
Sanity checks added to project wide input actions
lyndon-unity Feb 9, 2024
15648a4
Formatting fixes
lyndon-unity Feb 9, 2024
1c13eb7
More formatting fixes
lyndon-unity Feb 9, 2024
801eb62
Removed redundant code for saving InputActionAssets and relocated to …
ekcoh Feb 13, 2024
37ea711
Fixed reset behavior and reduced code duplication for saving assets. …
ekcoh Feb 13, 2024
cd60f80
Minor cleanup
ekcoh Feb 13, 2024
8112dbf
UNdo of over-generalization from asset importer and asset context
ekcoh Feb 14, 2024
ac40b7e
Fixed initial JSON name for project wide actions asset broken in last…
ekcoh Feb 14, 2024
deb178a
[Input] First pass migrating InputSystem's project-wide action assets…
AlexTyrer Feb 14, 2024
bb427f3
Updated InputActionAsset and InputActionReference property drawers
lyndon-unity Feb 14, 2024
1be5eb4
Merge branch 'isx-1865-project-wide-asset' of github.com:Unity-Techno…
lyndon-unity Feb 14, 2024
9555ee9
Removed a fix for ISX-1721 which is having a side effect of limiting …
Feb 14, 2024
3d663ba
Removed old comment
Feb 14, 2024
39b9efd
Formatting fixes
lyndon-unity Feb 14, 2024
223bc36
Removed custom icon for input action asset when project wide
lyndon-unity Feb 14, 2024
2a6b08a
Fixed formatting
lyndon-unity Feb 14, 2024
99efaf8
Fixed duplicated references in InputActionReference selection UI
lyndon-unity Feb 15, 2024
6ca5ce0
Fixed errors in 2019
lyndon-unity Feb 15, 2024
35b88ff
FIX: Project Settings Input Action Editor now handles deleting assets…
ekcoh Feb 15, 2024
172e652
Merge branch 'isx-1865-project-wide-asset' of github.com:Unity-Techno…
ekcoh Feb 15, 2024
8b10bda
FIX: Fixed compilation issues on 2023.3 and fixed broken UI validatio…
ekcoh Feb 15, 2024
1708607
Added confirmation box on creating an new asset that would overwrite …
lyndon-unity Feb 15, 2024
aee6812
[InputSystem] Only try to migrate project-wide input action assets fr…
AlexTyrer Feb 15, 2024
ce28301
Made sure project wide input actions are enabled on entering play mode
lyndon-unity Feb 15, 2024
c669ec5
Merge branch 'isx-1865-project-wide-asset' of github.com:Unity-Techno…
lyndon-unity Feb 15, 2024
53e313a
Disable project wide input actions on exit play mode (well enter edit…
lyndon-unity Feb 15, 2024
366e7e5
Removed QA utils for project wide actions since they cannot be used r…
ekcoh Feb 16, 2024
16ddda4
Merge branch 'develop' into isx-1865-project-wide-asset
ekcoh Feb 16, 2024
69f2d8e
FIX: Formatting
ekcoh Feb 16, 2024
f7d4b23
FIX: Compilation errors from merge, temporarily disabled ProjectWideA…
ekcoh Feb 16, 2024
a6ce6ce
FIX: Fixed an issue where AssetDatabase.AssetPathExists was used whic…
ekcoh Feb 16, 2024
621bcb2
FIX: Correct improper use of operator for null checks when using Unit…
ekcoh Feb 16, 2024
aa7ca47
Fixed 2021.3 compilation issue
Feb 16, 2024
e6e1f03
Fixes to make tests pass on standalone player
Feb 16, 2024
502c022
Fixed InputForUI tests and InputForUI to handle null InputSystem.actions
Feb 16, 2024
ba5bddd
InputForUI hook added to update when InputSystem.actions changes
Feb 16, 2024
52e17e7
FIX: Removed TODOs and uncommented code
ekcoh Feb 17, 2024
255f83e
Merge branch 'develop' into isx-1865-project-wide-asset
ekcoh Feb 17, 2024
eb7b70d
Restored code to set InputSystem.actions at runtime and fixed tests
Feb 17, 2024
930a6cf
Merge branch 'isx-1865-project-wide-asset' of github.com:Unity-Techno…
Feb 17, 2024
513fdf9
Formatting fix
Feb 17, 2024
5389210
FIX: Restore Defaults now also restores control schemes (binding groups)
ekcoh Feb 17, 2024
a316861
Merge branch 'isx-1865-project-wide-asset' of github.com:Unity-Techno…
ekcoh Feb 17, 2024
3b33251
Removed one test which is causing next two to fail
Feb 17, 2024
7e44945
Graceful disable actions to avoid asset on destruction
Feb 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
45 changes: 32 additions & 13 deletions Assets/Samples/ProjectWideActions/ProjectWideActionsExample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,46 @@ public class ProjectWideActionsExample : MonoBehaviour
void Start()
{
// Project-Wide Actions
move = InputSystem.actions.FindAction("Player/Move");
look = InputSystem.actions.FindAction("Player/Look");
attack = InputSystem.actions.FindAction("Player/Attack");
jump = InputSystem.actions.FindAction("Player/Jump");
interact = InputSystem.actions.FindAction("Player/Interact");
next = InputSystem.actions.FindAction("Player/Next");
previous = InputSystem.actions.FindAction("Player/Previous");
sprint = InputSystem.actions.FindAction("Player/Sprint");
crouch = InputSystem.actions.FindAction("Player/Crouch");
if (InputSystem.actions)
{
move = InputSystem.actions.FindAction("Player/Move");
look = InputSystem.actions.FindAction("Player/Look");
attack = InputSystem.actions.FindAction("Player/Attack");
jump = InputSystem.actions.FindAction("Player/Jump");
interact = InputSystem.actions.FindAction("Player/Interact");
next = InputSystem.actions.FindAction("Player/Next");
previous = InputSystem.actions.FindAction("Player/Previous");
sprint = InputSystem.actions.FindAction("Player/Sprint");
crouch = InputSystem.actions.FindAction("Player/Crouch");

if (!InputSystem.actions.enabled)
{
Debug.Log("Project Wide Input Actions should be enabled by default by Unity but they are not - enabling to make sure the input works");
InputSystem.actions.Enable();
}
}
else
{
Debug.Log("Setup Project Wide Input Actions in the Player Settings, Input System section");
}

// Handle input by responding to callbacks
attack.performed += ctx => cube.GetComponent<Renderer>().material.color = Color.red;
attack.canceled += ctx => cube.GetComponent<Renderer>().material.color = Color.green;
if (attack != null)
{
attack.performed += ctx => cube.GetComponent<Renderer>().material.color = Color.red;
attack.canceled += ctx => cube.GetComponent<Renderer>().material.color = Color.green;
}
}

// Update is called once per frame
void Update()
{
// Handle input by polling each frame
var moveVal = move.ReadValue<Vector2>() * 10.0f * Time.deltaTime;
cube.transform.Translate(new Vector3(moveVal.x, moveVal.y, 0));
if (move != null)
{
var moveVal = move.ReadValue<Vector2>() * 10.0f * Time.deltaTime;
cube.transform.Translate(new Vector3(moveVal.x, moveVal.y, 0));
}
}
} // class ProjectWideActionsExample
} // namespace UnityEngine.InputSystem.Samples.ProjectWideActions
Expand Down
9 changes: 6 additions & 3 deletions Assets/Tests/InputSystem/CoreTests_Editor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2907,9 +2907,12 @@ public void Editor_LeavingPlayMode_DestroysAllActionStates()
// Exclude project-wide actions from this test
// With Project-wide Actions `InputSystem.actions`, we begin with some initial ActionState
// Disabling Project-wide actions so that we begin from zero.
Assert.That(InputActionState.s_GlobalState.globalList.length, Is.EqualTo(1));
InputSystem.actions?.Disable();
InputActionState.DestroyAllActionMapStates();
if (InputSystem.actions)
{
Assert.That(InputActionState.s_GlobalState.globalList.length, Is.EqualTo(1));
InputSystem.actions?.Disable();
InputActionState.DestroyAllActionMapStates();
}
#endif

// Initial state
Expand Down