I’ve been trying to create a pause menu for my platformer game. It works, but when I unpause the game and the player is in the air, she shoots down if I wait long enough in the pause menu. My theory is that even though it may not look like it, Rigidbody2D is still updating while Timescale = 0.
https://vimeo.com/876762419
Does anyone know how to fix this problem?
If it’s not a problem, please tell me how to make it so I can change this.
It’s not the rigidbody, it’s likely your character control that is still operating while the game is paused. Probably creating a buildup of values that causes a large force to be applied.
2 Likes
Yeah, what Spiney says here:
If that is the case, then you need to start using Time.timeScale to scale your physics operations.
This way when paused, you can still keep calling stuff but it will all be with zeros, which is usually harmless.
Otherwise, do an:
if (Time.timeScale == 0) return;
and early-out of your controller code.
1 Like
You could easily see if the simulation is running by spinning up the profiler, select the CPU area and see if the playerloop FixedUpdate is being called which calls the scripts, physics, animation etc. Alternately, just search for “Physics2D.Simulate”.
I believe the correct answers are above though.

Spiney is correct. I’ve figured it out.
I made the player build up downwards speed when the jump key is let go in the air, but I didn’t realize that because I put that script in Update instead of FixedUpdate, the script kept going when timescale was 0 and released the force once timescale was back to 1.
Thanks, all of you!
1 Like