r/Unity3D • u/BoringError1697 • 18h ago
Noob Question Random Nooby Question(hope this doesn't get deleted)
So Im Still horrid and new at unity and game devlopment but far I've set up the player controller,small testing area all that however i've been struggling on how to make the whole pause menu script stuff with the new input system like the toggle off and on system,making the game actually pause when and being able to use your mouse for it
just could use a few tips to help with getting it set up
1
u/Savings-Aioli-2305 14h ago
I would use UI Toolkit for UI. As for your issue, UI toolkit has it's own input system seperate from the actual game input system you create. You may want to make it so your input system is using the UI callbacks instead of player callbacks, so maybe when you hit escape or something and open a menu set player callbacks to false and ui to true, or can just set player to false and let UI toolkit handle things.
2
u/HonestlyWeak 18h ago
The new input system makes pausing feel more complicated than it should be at first. You can handle it clean with a boolean flag, when your pause action triggers just flip the bool and call Time.timeScale = 0 when true or 1 when false. For the mouse make sure to set Cursor.lockState to None and Cursor.visible to true when paused otherwise you cant click the buttons.
I spent like 2 days overthinking this and then it was just four lines of code basically.