I am using Unity 2023.1.2
My input settings:
My code to switch to the desired map:
private void SetInputMap(bool specific = false)
{
try
{
if (Globals.Players.Count == 1 && specific)
{
GetComponent<PlayerInput>().enabled = true;
GetComponent<PlayerInput>().SwitchCurrentActionMap("All");
}
else if (Globals.Players[PlayerIndex].InputIndex == 0)
{
GetComponent<PlayerInput>().enabled = true;
GetComponent<PlayerInput>().SwitchCurrentActionMap("Player1");
}
else if (Globals.Players[PlayerIndex].InputIndex == 1)
{
GetComponent<PlayerInput>().enabled = true;
GetComponent<PlayerInput>().SwitchCurrentActionMap("Player2");
}
else if (Globals.Players[PlayerIndex].InputIndex > 1)
{
GetComponent<PlayerInput>().enabled = true;
GetComponent<PlayerInput>().SwitchCurrentActionMap("Player3");
}
}
catch (System.Exception e)
{
Debug.LogError("SetInputMap" + e.ToString());
if (!specific)
{
SetInputMap(true);
}
}
}
It worked before. but since updateing Unity or I don’t know what else chaged I always get the error:
Cannot switch to actions ‘Player1’; input is not enabled
Any idea? Thanks!
OM_Internal_Log_Injected
0x000001d44e66fd3a (Mono JIT Code) (wrapper managed-to-native) UnityEngine.DebugLogHandler:Internal_Log_Injected (UnityEngine.LogType,UnityEngine.LogOption,string,intptr)
0x000001d44e66fbeb (Mono JIT Code) UnityEngine.DebugLogHandler:Internal_Log (UnityEngine.LogType,UnityEngine.LogOption,string,UnityEngine.Object)
0x000001d44e66faab (Mono JIT Code) UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
0x000001d45129849e (Mono JIT Code) UnityEngine.Logger:Log (UnityEngine.LogType,object,UnityEngine.Object)
0x000001d45129821b (Mono JIT Code) UnityEngine.Debug:LogError (object,UnityEngine.Object)
0x000001d678677c3b (Mono JIT Code) UnityEngine.InputSystem.PlayerInput:SwitchCurrentActionMap (string) (at ./Library/PackageCache/com.unity.inputsystem@1.6.1/InputSystem/Plugins/PlayerInput/PlayerInput.cs:964)
0x000001d451297b0b (Mono JIT Code) PlayerControl:SetInputMap (bool) (at C:/Unity/Evasion from cluster 42/Assets/Scripts/PlayerControl.cs:236)
0x000001d4512967eb (Mono JIT Code) PlayerControl:Init (int) (at C:/Unity/Evasion from cluster 42/Assets/Scripts/PlayerControl.cs:214)
0x000001d67879e0f3 (Mono JIT Code) GameManager:StartLevel (UnityEngine.Mesh,UnityEngine.Material,bool,UnityEngine.GameObject,bool,bool,bool,bool,int,UnityEngine.GameObject,bool,bool) (at C:/Unity/Evasion from cluster 42/Assets/Scripts/GameManager.cs:3433)
0x000001d67879bd2b (Mono JIT Code) Navigator:StartNewLevel (PlanetInfo,UnityEngine.Transform,bool,bool) (at C:/Unity/Evasion from cluster 42/Assets/Scripts/Navigator.cs:759)
0x000001d67879a0cb (Mono JIT Code) CutsceneInGameManager:EndCutScene () (at C:/Unity/Evasion from cluster 42/Assets/Scripts/CutScenes/CutsceneInGameManager.cs:1598)
0x000001d3ba14d043 (Mono JIT Code) TimeLineCamera:Update () (at C:/Unity/Evasion from cluster 42/Assets/Scripts/CutScenes/TimeLineCamera.cs:231)
0x000001d450fc1b58 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr)
0x00007ff9a748d6a4 (mono-2.0-bdwgc) mono_jit_runtime_invoke (at C:/build/output/Unity-Technologies/mono/mono/mini/mini-runtime.c:3445)
0x00007ff9a73d85c4 (mono-2.0-bdwgc) do_runtime_invoke (at C:/build/output/Unity-Technologies/mono/mono/metadata/object.c:3066)
0x00007ff9a73d86d5 (mono-2.0-bdwgc) mono_runtime_invoke (at C:/build/output/Unity-Technologies/mono/mono/metadata/object.c:3113)
0x00007ff9a1bb26e4 (Unity) scripting_method_invoke
0x00007ff9a1b90784 (Unity) ScriptingInvocation::Invoke
0x00007ff9a1b77ea4 (Unity) MonoBehaviour::CallMethodIfAvailable
0x00007ff9a1b77fca (Unity) MonoBehaviour::CallUpdateMethod
0x00007ff9a161332b (Unity) BaseBehaviourManager::CommonUpdate<BehaviourManager>
0x00007ff9a161ac5a (Unity) BehaviourManager::Update
0x00007ff9a18471ad (Unity) `InitPlayerLoopCallbacks'::`2'::UpdateScriptRunBehaviourUpdateRegistrator::Forward
0x00007ff9a182e0da (Unity) ExecutePlayerLoop
0x00007ff9a182e26b (Unity) ExecutePlayerLoop
0x00007ff9a18342e5 (Unity) PlayerLoop
0x00007ff9a27c998a (Unity) PlayerLoopController::InternalUpdateScene
0x00007ff9a27d680d (Unity) PlayerLoopController::UpdateSceneIfNeededFromMainLoop
0x00007ff9a27d4b5c (Unity) Application::TickTimer
0x00007ff9a2c3670a (Unity) MainMessageLoop
0x00007ff9a2c3b776 (Unity) UnityMain
0x00007ff74b7129fa (Unity) __scrt_common_main_seh
0x00007ffa33c426ad (KERNEL32) BaseThreadInitThunk
0x00007ffa3582aa68 (ntdll) RtlUserThreadStart