Hi, I am using the latest unity 6000.0.47f1.
I recently added input system integration to the project because I wanted to add the ability to remap the buttons on the keyboard and gamepad.
However, I encountered a problem because the Player Input component on the “EventSystem_InputSystem” object uses a clone of Controls.inputactions after startup. On the other hand, the Input Remapper component in InputUI refers to the action in the orginal Controls.inputactions file
As a result, button remapping did not work and did not save in variables. I couldn't find any option to fix it, so I edited the code.
The code finds the currently used Asset clone and in-game remapping works. But I have a question if I missed a better solution or if my solution is unsafe, there may be some errors?
In addition, the “EventSystem_InputSystem” object added as a prefab in the Menu tab is deleted and re-created every scene change. I added a SurviveSceneChange component on it. Will this not cause any errors?
Sorry if the topic has already been on the forum but I couldn't find it
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
Welcome to the community, @dyferspaw.
Thanks for the detailed post.
For the integration to work correctly, each of the input references should map to the cloned Controls asset.
As part of the template's installation, the input references in both the Event System and InputsUI prefabs should be made to point to the cloned asset.
This should be ultimately handled within the RemappableAction script's SwapInputActionAsset function.
I've recreated this on my end, and I'll see if I can get to the bottom of it. In the meantime, manually pointing each of the component Inspector's inputs to refer to the clone should get things working again.
Update: Looks like this was a quick fix. I've updated the package file - re-installing it should now give the correct references.
Hi,
I removed and re-uploaded the package from the site and configured, however, still the default UI does not work for me and the InputRebindings variable does not update, probably I am making a mistake somewhere. I attach the video
Thank you very much for your quick response and help, I am grateful.
The Input UI now references the correct Input Actions asset, but for some reason each of the four Input Action Reference fields now all point to the same thing - ToggleCursor.
Is this a manual change? ToggleCursor isn't defined in the integration's default Controls asset.
For the InputsUI menu to work, each of the fields in the array need to point to a unique action within your own Controls asset. The size of the array need not be 4 - only as large as the number of inputs you want to remap.
This is with the Variables Manager open and Show realtime values? checked?
When the input is changed, the variable should get updated via:
At which point, AC will report the missing variable if it doesn't exist.
Do any Debug.Log statements inserted in these functions show this chain is running?
Yes it was my manual temporary change to ToggleCursor
I imported the package again and left the default assets. However, remapping a button in the UI in the game still doesn't change anything. As in the video the character still runs only on shift.
No other debug logs with error information appear. With saving variables there is no problem, but it does not save anything, because remapping buttons in game still does not work for me. (when I manually replace inputasset clone with orginal in the running game in eventsystem, the variable saves the values)
I added some debug logs in the code
Debug.Log("GetNewInputActionReference called"); - not called
Debug.Log("SwapInputActionAsset called"); - not called
Debug.Log("saved:" + playerInput.actions.SaveBindingOverridesAsJson()); - empty debug log
Thanks for the details, I have recreated the issue on my end.
It may be due to a change in the Input System package - I'll look into this and see what's going on.
OK, this should be fixed now.
The issue was that Input System now clones the Input Actions asset at runtime, while the Inputs UI component still references the originals.
The updated package should now sync them together again.
Exactly right, now everything works perfect!
Thank you very much for your help.