Issues with new Input system


Author: Chance King


This week I've been trying to tackle an issue we had with our UI pause menu. There was an issue with using the new input system where having a unique player input component on the UI canvas for each scene would throw null references whenever loading into a new scene. This would in turn cause the input in the newly loaded scene to stop working, making it impossible to pull up the pause menu. 

While I never was able to track down the root of the issue, being that the error message was really vague and didn't lead me to any point in code, I did end up finding a workaround solution. That solution came in part by using the player input component that the cheat handler runs off. Since it was on an object that is set to do not destroy, having the component removed and reloaded every scene was no longer an issue. I just added a new OnEscape function to the cheat handler and had it sent out when it was being pressed for the UI to be able to read. And just like that the UI was back on track and working in every scene again. And with the upside of not having to destroy a player input component every time the player changes scenes, while a small cost it is still a cost to be happy with cutting out.


Leave a comment

Log in with itch.io to leave a comment.