I know this is kinda common issue, I saw a few people complaining about this problem. But it seemed like the most of them haven’t fixed it. And I haven’t been able to fix this as well.
Seems like the new input only works on Editor / Testing, but not after you build it.
I am currently using unity 2019.4.31f and built the game on window 32_64. So, anyone got a good way to deal with it?
Using Unity 2020.3.14f1 and I have the new Input System in use, and it works fine when playing from editor, but when I build my game the inputs do not work. I have tried setting the Architecture in the build settings to bot x86 and x86-64 and it will not work. This is for a Windows build as the target platform.
Try upgrading to 1.2.0 by changing manifest.json version string. How is your input action asset looks like for “PLAYER.DPAD”? Is Input system set to dynamic updates in Project Settings → Input System?
Hello There,
I’m having the exactly the same issue. Inputs are Working totally fine in editor, but when I build the Game (Windows x86) in Unity 2020.3.3f1 (InputSystem 1.0.2), the Inputs aren’t working. The Development Console pops up in the build game (screenshot below).
The issue is when I enable InputActions.GamePlay using
private void OnEnable()
{
if (gameInput == null)
{
gameInput = new GameInput();
gameInput.Gameplay.SetCallbacks(this);
}
gameInput.Gameplay.Enable();
}
Here is how you can always install any version of any existing package from the package manager. You obviously should use the proper version number string. If you don’t have the Add package by name option, you can use the Add package from git URL option too. In that case you need to compose the string like this: PACKAGE_NAME@<VERSION_NUMBER> so for example com.unity.inputsystem@1.2.0.
Hi and thanks for reply.
I tried updating to 1.2.0, but sadly, still no change…
The only change is in the error message is that it is inputsystem@.1.2.0 instead of inputsystem@1.0.2
Relevant Part from the Player Log:
Player.log
Begin MonoManager ReloadAssembly
Completed reload, in 1.725 seconds
D3D11 device created for Microsoft Media Foundation video decoding.
Initializing input.
New input system (experimental) initialized
Initialized touch support.
NullReferenceException while resolving binding ‘Move:1DAxis’ in action map ‘GameInput (UnityEngine.InputSystem.InputActionAsset):Gameplay’
UnityEngine.StackTraceUtility:ExtractStackTrace ()
UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[ ])
UnityEngine.Logger:Log (UnityEngine.LogType,object)
UnityEngine.Debug:LogError (object)
UnityEngine.InputSystem.InputBindingResolver:AddActionMap (UnityEngine.InputSystem.InputActionMap) (at D:/Game-Jams/Game Off 2021/Library/PackageCache/com.unity.inputsystem@1.2.0/InputSystem/Actions/InputBindingResolver.cs:414)
UnityEngine.InputSystem.InputActionMap:ResolveBindings () (at D:/Game-Jams/Game Off 2021/Library/PackageCache/com.unity.inputsystem@1.2.0/InputSystem/Actions/InputActionMap.cs:1169)
UnityEngine.InputSystem.InputActionMap:ResolveBindingsIfNecessary () (at D:/Game-Jams/Game Off 2021/Library/PackageCache/com.unity.inputsystem@1.2.0/InputSystem/Actions/InputActionMap.cs:1065)
UnityEngine.InputSystem.InputActionMap:Enable () (at D:/Game-Jams/Game Off 2021/Library/PackageCache/com.unity.inputsystem@1.2.0/InputSystem/Actions/InputActionMap.cs:500)
GameInput/GameplayActions:Enable () (at D:/Game-Jams/Game Off 2021/Assets/Scripts/Input/GameInput.cs:338)
InputReader:EnableGameplayInput () (at D:/Game-Jams/Game Off 2021/Assets/Scripts/ScriptableObjects/Input/InputReader.cs:69)
InputReader:OnEnable () (at D:/Game-Jams/Game Off 2021/Assets/Scripts/ScriptableObjects/Input/InputReader.cs:28)
(Filename: D:/Game-Jams/Game Off 2021/Library/PackageCache/com.unity.inputsystem@1.2.0/InputSystem/Actions/InputBindingResolver.cs Line: 414)
NullReferenceException: Object reference not set to an instance of an object
at UnityEngine.InputSystem.Utilities.TypeTable.LookupTypeRegistration (System.String name) [0x00023] in D:\Game-Jams\Game Off 2021\Library\PackageCache\com.unity.inputsystem@1.2.0\InputSystem\Utilities\TypeTable.cs:69
at UnityEngine.InputSystem.InputBindingResolver.InstantiateBindingComposite (System.String nameAndParameters) [0x00008] in D:\Game-Jams\Game Off 2021\Library\PackageCache\com.unity.inputsystem@1.2.0\InputSystem\Actions\InputBindingResolver.cs:645
at UnityEngine.InputSystem.InputBindingResolver.AddActionMap (UnityEngine.InputSystem.InputActionMap map) [0x00497] in D:\Game-Jams\Game Off 2021\Library\PackageCache\com.unity.inputsystem@1.2.0\InputSystem\Actions\InputBindingResolver.cs:345
UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object)
UnityEngine.DebugLogHandler:LogException(Exception, Object)
UnityEngine.Logger:LogException(Exception, Object)
UnityEngine.Debug:LogException(Exception)
UnityEngine.InputSystem.InputBindingResolver:AddActionMap(InputActionMap) (at D:\Game-Jams\Game Off 2021\Library\PackageCache\com.unity.inputsystem@1.2.0\InputSystem\Actions\InputBindingResolver.cs:416)
UnityEngine.InputSystem.InputActionMap:ResolveBindings() (at D:\Game-Jams\Game Off 2021\Library\PackageCache\com.unity.inputsystem@1.2.0\InputSystem\Actions\InputActionMap.cs:1169)
UnityEngine.InputSystem.InputActionMap:ResolveBindingsIfNecessary() (at D:\Game-Jams\Game Off 2021\Library\PackageCache\com.unity.inputsystem@1.2.0\InputSystem\Actions\InputActionMap.cs:1065)
UnityEngine.InputSystem.InputActionMap:Enable() (at D:\Game-Jams\Game Off 2021\Library\PackageCache\com.unity.inputsystem@1.2.0\InputSystem\Actions\InputActionMap.cs:500)
GameplayActions:Enable() (at D:\Game-Jams\Game Off 2021\Assets\Scripts\Input\GameInput.cs:338)
InputReader:EnableGameplayInput() (at D:\Game-Jams\Game Off 2021\Assets\Scripts\ScriptableObjects\Input\InputReader.cs:69)
InputReader:OnEnable() (at D:\Game-Jams\Game Off 2021\Assets\Scripts\ScriptableObjects\Input\InputReader.cs:28)
(Filename: D:/Game-Jams/Game Off 2021/Library/PackageCache/com.unity.inputsystem@1.2.0/InputSystem/Utilities/TypeTable.cs Line: 69)
NullReferenceException: Object reference not set to an instance of an object
at UnityEngine.InputSystem.Utilities.TypeTable.LookupTypeRegistration (System.String name) [0x00023] in D:\Game-Jams\Game Off 2021\Library\PackageCache\com.unity.inputsystem@1.2.0\InputSystem\Utilities\TypeTable.cs:69
at UnityEngine.InputSystem.InputBindingResolver.InstantiateBindingComposite (System.String nameAndParameters) [0x00008] in D:\Game-Jams\Game Off 2021\Library\PackageCache\com.unity.inputsystem@1.2.0\InputSystem\Actions\InputBindingResolver.cs:645
at UnityEngine.InputSystem.InputBindingResolver.AddActionMap (UnityEngine.InputSystem.InputActionMap map) [0x00b24] in D:\Game-Jams\Game Off 2021\Library\PackageCache\com.unity.inputsystem@1.2.0\InputSystem\Actions\InputBindingResolver.cs:571
at UnityEngine.InputSystem.InputActionMap.ResolveBindings () [0x00194] in D:\Game-Jams\Game Off 2021\Library\PackageCache\com.unity.inputsystem@1.2.0\InputSystem\Actions\InputActionMap.cs:1169
at UnityEngine.InputSystem.InputActionMap.ResolveBindingsIfNecessary () [0x00042] in D:\Game-Jams\Game Off 2021\Library\PackageCache\com.unity.inputsystem@1.2.0\InputSystem\Actions\InputActionMap.cs:1065
at UnityEngine.InputSystem.InputActionMap.Enable () [0x00022] in D:\Game-Jams\Game Off 2021\Library\PackageCache\com.unity.inputsystem@1.2.0\InputSystem\Actions\InputActionMap.cs:500
at GameInput+GameplayActions.Enable () [0x00001] in D:\Game-Jams\Game Off 2021\Assets\Scripts\Input\GameInput.cs:338
at InputReader.EnableGameplayInput () [0x00001] in D:\Game-Jams\Game Off 2021\Assets\Scripts\ScriptableObjects\Input\InputReader.cs:69
at InputReader.OnEnable () [0x00030] in D:\Game-Jams\Game Off 2021\Assets\Scripts\ScriptableObjects\Input\InputReader.cs:28
(Filename: D:/Game-Jams/Game Off 2021/Library/PackageCache/com.unity.inputsystem@1.2.0/InputSystem/Utilities/TypeTable.cs Line: 69)
I believe it is only working in the editor because you’re trying to use it from a ScriptableObject.
And if I’m right, the ScriptableObject in the editor will run the OnEnable when the asset is created or the project is loaded ant not when you hit play.
In the build however, and obviously, the ScriptableObject only loads with the other stuff and only if anything is referencing it.
I would highly recommend not to do this from a ScriptableObject and also, it would be a good idea to initialize your gameInput variable from Awake. This way you can avoid any kind of race condition and accidental reference to your InputActionAsset and maps and everything from Start calls and other OnEnable calls (there is no guarantee that one object’s OnEnable will be called before the other object’s.
Hi, this Scriptable Object Architecture is one of the things that I learned from the Unity open-project-1 (named ChopChop) community. I am using the exactly same method to get input, and ChopChop’s inputs are working fine in build. Infact I have used this ScriptableObject input reader workflow in one of my ongoing Android game project, and the inputs on the device are also working…
Many Scripts are referencing it for reading input.
And for the confusion of whether the methods of InputReader asset are called or not, here are the console logs
Hey there @ , thanks for you support, and the good news is it worked (finally)…
What I just did, reading other threads, deleted the Move bindings in the Inputactions Asset, remade them as they were, and built the game. And inputs were working fine with the enabling function being called in OnEnable with no Awake method at all.
I guess this was because of I created the asset using InputSystem 1.0.2 and then updated to 1.2.0 (as you suggested), this may have gave rise to incompability with that InputActions asset.
Those with the same problem, just remove and remake the binding which is giving you the error in the build, in my case it was:
I’m seeing a similar issue, though I’m using Visual Scripting for the state machine.
I set up a simple test in a new project. A sphere with a rigid body and the all the state graph does is on fixed update check if the input button for jump has phase of performed, if true then add a force to the rb. Works fine in the editor, but after doing a build it doesn’t work, no errors that I can see.
If I move the functionality into fixed update in a script it works in the build
I’ve been having and solving this issue several times in my project recently. Based on my experiences so far, Unity is probably falsely blaming the input system for the null reference errors happening in your code, meaning that the real issue has most likely something to do with your code.
I suggest replacing the code triggered by your input events with simple Debug.Log string messages. If no errors occur, focus your investigation on the original lines of code you were using.