I’m working in the Pause Menu with Time.timeScale and the only problem is been that player is not fully freezing. When i pause, he stop, the animator show that he is stoped, but if i use some moviment key, he “try” the transition for the next animation, but get stuck. Here a video to be easier to understand.
The input system still responding. In my searchs, i got that can be something related to my Updade(), FixedUpdate(), Time.deltaTime or Time.fixedDeltaTime, things like this.
I’m no expert on this, but Unity will still look at your inputs and execute code when Time.timeScale is 0, you wouldn’t be able to unpause the game otherwise.
According to that page, Update() will continue to be called, except for anything in Update() that relies on time based measurements. So the game is still reading your movement inputs and executing code based off that.
If you don’t want anything in your Update() method to run at all while the game paused, you could add something like this to the beginning of the method:
void Update()
{
if (Time.timeScale < 0.1f) { return; }
if (state == State.Idle)
{
Movement();
Actions();
}
if (state == State.Rolling)
{
Roll();
}
}
This will return out of the method if Time.timeScale is less than 0.1f, effectively ignoring all of your inputs.
The above is just an example, the page I linked covers this in depth, so give that a look if you’d like to learn more. Use CRTL + F to search the page for “How to prevent control input when the game is paused” - this section has a lot of relevant information.
I was trying something like this, put my inputs pass by a bool gameIsPaused verification, but i will read this article to find a best way with lowest performance impact, including this your suggention.