Skip to content

Commit 538107a

Browse files
committed
Fix branch after rebasing with develop (ISX-1840)
- Most ProjectWideAction changes discarded since feature was re-implemented (no longer relevant) - Recreate InputSystem "Test Hook" for Enabling/Disabling Actions from tests - Small fixes from unresolved conflicts or bad merges during rebase - Various formatting changes (to be more consistant)
1 parent f48d6ef commit 538107a

File tree

8 files changed

+123
-126
lines changed

8 files changed

+123
-126
lines changed

Assets/Tests/InputSystem/CoreTests_ProjectWideActions.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ private static void CreateAndAssignProjectWideTestAsset()
3838
else
3939
EditorBuildSettings.RemoveConfigObject(name: kSavedActionsObject);
4040

41+
// Create temporary asset and assign as setting
42+
var asset = ProjectWideActionsAsset.CreateDefaultAssetAtPath(kAssetPath);
43+
ProjectWideActionsBuildProvider.actionsToIncludeInPlayerBuild = asset;
4144
#endif
4245
}
4346

Assets/Tests/InputSystem/Plugins/InputForUITests.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public override void TearDown()
6060
EventProvider.ClearMockProvider();
6161
m_InputForUIEvents.Clear();
6262

63-
InputSystem.s_Manager.actions = storedActions;
63+
InputSystem.manager.actions = storedActions;
6464

6565
#if UNITY_EDITOR
6666
if (File.Exists(kAssetPath))
@@ -193,7 +193,7 @@ public void UIActionNavigation_FiresUINavigationEvents_FromInputsGamepadJoystick
193193
// Remove the project-wide actions asset in play mode and player.
194194
// It will call InputSystem.onActionChange and re-set InputSystemProvider.actionAsset
195195
// This the case where no project-wide actions asset is available in the project.
196-
InputSystem.s_Manager.actions = null;
196+
InputSystem.manager.actions = null;
197197
}
198198
Update();
199199

@@ -267,7 +267,7 @@ public void UIActionSubmit_FiresUISubmitEvents_FromInputsGamepadJoystickAndKeybo
267267
Update();
268268
if (!useProjectWideActionsAsset)
269269
{
270-
InputSystem.s_Manager.actions = null;
270+
InputSystem.manager.actions = null;
271271
}
272272
Update();
273273

@@ -304,7 +304,7 @@ public void UIActionCancel_FiresUICancelEvents_FromInputsGamepadAndKeyboard(bool
304304
Update();
305305
if (!useProjectWideActionsAsset)
306306
{
307-
InputSystem.s_Manager.actions = null;
307+
InputSystem.manager.actions = null;
308308
}
309309
Update();
310310

@@ -334,7 +334,7 @@ public void UIActionPoint_FiresUIPointEvents_FromInputsMousePenAndTouch(bool use
334334
Update();
335335
if (!useProjectWideActionsAsset)
336336
{
337-
InputSystem.s_Manager.actions = null;
337+
InputSystem.manager.actions = null;
338338
}
339339
Update();
340340

@@ -386,7 +386,7 @@ public void UIActionClick_FiresUIClickEvents_FromInputsMousePenAndTouch(bool use
386386
Update();
387387
if (!useProjectWideActionsAsset)
388388
{
389-
InputSystem.s_Manager.actions = null;
389+
InputSystem.manager.actions = null;
390390
}
391391
Update();
392392

@@ -471,7 +471,7 @@ public void UIActionScroll_FiresUIScrollEvents_FromInputMouse(bool useProjectWid
471471
Update();
472472
if (!useProjectWideActionsAsset)
473473
{
474-
InputSystem.s_Manager.actions = null;
474+
InputSystem.manager.actions = null;
475475
}
476476
Update();
477477

@@ -502,7 +502,7 @@ public void UIActionScroll_FiresUIScrollEvents_FromInputMouse(bool useProjectWid
502502
public void DefaultActions_ShouldNotGenerateAnyVerificationWarnings(bool useProjectWideActions)
503503
{
504504
if (!useProjectWideActions)
505-
InputSystem.s_Manager.actions = null;
505+
InputSystem.manager.actions = null;
506506
Update();
507507
LogAssert.NoUnexpectedReceived();
508508
}
@@ -515,7 +515,7 @@ public void ActionsWithoutUIMap_ShouldGenerateWarnings()
515515
var asset = ProjectWideActionsAsset.CreateDefaultAssetAtPath(kAssetPath);
516516
asset.RemoveActionMap(asset.FindActionMap("UI", throwIfNotFound: true));
517517

518-
InputSystem.s_Manager.actions = asset;
518+
InputSystem.manager.actions = asset;
519519
Update();
520520

521521
var link = EditorHelpers.GetHyperlink(kAssetPath);
@@ -551,7 +551,7 @@ public void ActionMapWithNonExistentRequiredAction_ShouldGenerateWarning(string
551551
var action = asset.FindAction(actionPath);
552552
action.Rename("Other");
553553

554-
InputSystem.s_Manager.actions = asset;
554+
InputSystem.manager.actions = asset;
555555
Update();
556556

557557
//var link = AssetDatabase.GetAssetPath()//EditorHelpers.GetHyperlink(kAssetPath);
@@ -594,7 +594,7 @@ public void ActionMapWithUnboundRequiredAction_ShouldGenerateWarning(string acti
594594

595595
asset.AddActionMap(newMap);
596596

597-
InputSystem.s_Manager.actions = asset;
597+
InputSystem.manager.actions = asset;
598598
Update();
599599

600600
LogAssert.Expect(LogType.Warning, new Regex($"^InputAction with path '{actionPath}' in asset \"{kAssetPath}\" do not have any configured bindings."));
@@ -619,7 +619,7 @@ public void ActionWithUnexpectedActionType_ShouldGenerateWarning(string actionPa
619619
var expectedType = action.type;
620620
action.m_Type = unexpectedType; // change directly via internals for now
621621

622-
InputSystem.s_Manager.actions = asset;
622+
InputSystem.manager.actions = asset;
623623
Update();
624624

625625
LogAssert.Expect(LogType.Warning,
@@ -645,7 +645,7 @@ public void ActionWithDifferentExpectedControlType_ShouldGenerateWarning(string
645645
var expectedControlType = action.expectedControlType;
646646
action.expectedControlType = unexpectedControlType;
647647

648-
InputSystem.s_Manager.actions = asset;
648+
InputSystem.manager.actions = asset;
649649
Update();
650650

651651
LogAssert.Expect(LogType.Warning,

Packages/com.unity.inputsystem/InputSystem/Editor/ProjectWideActions/ProjectWideActionsAsset.cs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS
1+
#if UNITY_EDITOR && UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS
22

33
using System;
44
using System.Collections.Generic;
@@ -28,6 +28,7 @@ class ProjectSettingsPostprocessor : AssetPostprocessor
2828
private static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths, bool didDomainReload)
2929
#else
3030
private static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
31+
#endif
3132
{
3233
if (!migratedInputActionAssets)
3334
{
@@ -45,14 +46,19 @@ private static void OnPostprocessAllAssets(string[] importedAssets, string[] del
4546
}
4647
}
4748
}
48-
}
49-
}
5049

50+
private static void MoveInputManagerAssetActionsToProjectWideInputActionAsset()
5151
{
5252
var objects = AssetDatabase.LoadAllAssetsAtPath(EditorHelpers.GetPhysicalPath(kAssetPathInputManager));
5353
if (objects == null)
5454
return;
5555

56+
var inputActionsAsset = objects.FirstOrDefault(o => o != null && o.name == kAssetNameProjectWideInputActions) as InputActionAsset;
57+
if (inputActionsAsset != default)
58+
{
59+
// Found some actions in the InputManager.asset file
60+
//
61+
string path = ProjectWideActionsAsset.kDefaultAssetPath;
5662

5763
if (File.Exists(EditorHelpers.GetPhysicalPath(path)))
5864
{
@@ -305,7 +311,6 @@ private static InputActionAsset CreateAssetAtPathFromJson(string assetPath, stri
305311
InputActionAssetManager.SaveAsset(assetPath, inputActionAsset.ToJson());
306312
return AssetDatabase.LoadAssetAtPath<InputActionAsset>(assetPath);
307313
}
308-
#endif // UNITY_EDITOR
309314
}
310315
}
311316
#endif // UNITY_EDITOR && UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS

0 commit comments

Comments
 (0)