Skip to content

Commit 5b8745d

Browse files
committed
Tentative enable fix that seems to work in practise but fails tests.
1 parent b4022a9 commit 5b8745d

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

Packages/com.unity.inputsystem/InputSystem/InputManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2027,7 +2027,7 @@ internal void InitializeData()
20272027
composites.AddTypeRegistration("TwoModifiers", typeof(TwoModifiersComposite));
20282028

20292029
// Register custom types by reflection
2030-
RegisterCustomTypes();
2030+
//RegisterCustomTypes();
20312031
}
20322032

20332033
void RegisterCustomTypes(Type[] types)

Packages/com.unity.inputsystem/InputSystem/InputSystem.cs

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -879,7 +879,7 @@ public static void RegisterProcessor(Type type, string name = null)
879879
{
880880
if (type == null)
881881
throw new ArgumentNullException(nameof(type));
882-
882+
883883
// Default name to name of type without Processor suffix.
884884
if (string.IsNullOrEmpty(name))
885885
{
@@ -895,6 +895,8 @@ public static void RegisterProcessor(Type type, string name = null)
895895
if (StringHelpers.CharacterSeparatedListsHaveAtLeastOneCommonElement(precompiledLayouts[key].metadata, name, ';'))
896896
s_Manager.m_Layouts.precompiledLayouts.Remove(key);
897897
}
898+
899+
Debug.Log($"Registering {type} with alias {name}");
898900

899901
s_Manager.processors.AddTypeRegistration(name, type);
900902
}
@@ -3597,7 +3599,9 @@ internal static void InitializeInEditor(IInputRuntime runtime = null)
35973599
// this would cancel the import of large assets that are dependent on the InputSystem package and import it as a dependency.
35983600
EditorApplication.delayCall += ShowRestartWarning;
35993601

3600-
RunInitialUpdate();
3602+
// Run initial update but defer enabling actions until before-scene initialization hook.
3603+
// This allows type registrations to execute before attempting to enable Project-wide input actions.
3604+
RunInitialUpdate(false);
36013605

36023606
k_InputInitializeInEditorMarker.End();
36033607
}
@@ -3763,14 +3767,21 @@ private static void InitializeInPlayer(IInputRuntime runtime = null, InputSettin
37633767
#endif
37643768

37653769
// This is the point where we initialise project-wide actions for the Player
3766-
EnableActions();
3770+
// EnableActions();
37673771
}
37683772

37693773
#endif // UNITY_EDITOR
37703774

37713775
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
37723776
private static void RunInitialUpdate()
37733777
{
3778+
RunInitialUpdate(true);
3779+
}
3780+
3781+
private static void RunInitialUpdate(bool enableActions)
3782+
{
3783+
Debug.Log($"RunInitialUpdate enableActions={enableActions}");
3784+
37743785
// Request an initial Update so that user methods such as Start and Awake
37753786
// can access the input devices.
37763787
//
@@ -3779,6 +3790,10 @@ private static void RunInitialUpdate()
37793790
// mask but will still restore devices. This means we're not actually processing input,
37803791
// but we will force the runtime to push its devices.
37813792
Update(InputUpdateType.None);
3793+
3794+
// If this was invoked as a runtime initialization hook we enable actions
3795+
if (enableActions)
3796+
EnableActions();
37823797
}
37833798

37843799
#if !UNITY_DISABLE_DEFAULT_INPUT_PLUGIN_INITIALIZATION
@@ -3902,7 +3917,7 @@ private static void Reset(bool enableRemoting = false, IInputRuntime runtime = n
39023917
EnhancedTouchSupport.Reset();
39033918

39043919
// This is the point where we initialise project-wide actions for the Editor Play-mode, Editor Tests and Player Tests.
3905-
EnableActions();
3920+
//EnableActions();
39063921

39073922
k_InputResetMarker.End();
39083923
}

0 commit comments

Comments
 (0)