use Time.timescale = 0 with time.deltatime problem
Hi , i need countdown for start game.Time.timescale is "0" when the game start.Therefore my countdown not working.
Could you help me ?
public bool isGameStart=false;
private float gameStartTime=3.0f;
public Text timerText;
void Update(){
GameStart();
}
private void GameStart(){
gameStartTime -= Time.deltaTime;
timerText.text = gameStartTime.ToString ("0");
if (!isGameStart) {
Time.timeScale = 0;
} else
Time.timeScale = 1f;
if (gameStartTime <= 0) {
isGameStart = false;
}
}
i don't use the timeScale, mainly because if it is = 0 it stops all the update frames.
because it was set to 0 once, it paused the game, and everything else.
Thank you for answer.I understand , i should only use for toggle pause
[ anytime ]
I don't know of a way, at the moment to get the result, but there may be ways to get the result you're looking for without pausing the whole editor.
i would look up a few terms dealing with pausing a scene without it affecting the entire editor's update frames, so you can achieve your goal.
Answer by KoenigX3 · Jan 15, 2017 at 05:51 PM
Time.unscaledDeltaTime is unaffected by timeScale, you can use that instead.