- Home /
Im making game using Unity. I want to make everything else stop moving while player answering pop out question.
Hi. I make a script that will trigger question panel. So I want everything else is in pause while the player still interacting with the answering question. I use Time.timeScale=0 and for the boat movement i already use Time.deltaTime. But the boat still moving when the question pop out. Anybody knows how to stop the boat from moving?
Answer by davidcox70 · Aug 12, 2020 at 08:23 AM
Setting time scale to 0 should set Time.deltaTime to 0, so it should work. Just double check that you are multiplying all moving elements by Time.deltaTime.
Note that Time.fixedDeltaTime, which is the rate at which the physics system (e.g. rigidbodies) works does not respond to Time.timeScale. So you would need to multiply the fixed update rate by time scale to get the same effect.
Generally, using time scale set to zero as a pause can cause problems. For example, let's say you want to animate the text on your pop-up question panel. You can't if the time scale is 0 because there won't be any animation. A better approach is to set a boolean "isPaused" and contain your movement scripts with an "if (isPaused)" condition. This will allow you to pause some things independently.
Your answer
