hi guys in my scene i have a simple sprite and a camera
in the sprite i have this script :
void Update () {
transform.Translate(new Vector3 (1, 0, 0) * velocità);
} velocità is a variable out if the function is just 0.01f; aniway the sprite move
in the camera i have the script pause
void Update () {
Debug.Log (Time.timeScale);
Time.timeScale = 0;
}
it debug all time 0 but the sprite dont stop to move. i tried 0.5, 1 but is all time the same, the sprite dont change his move, no slow no stop, how D: put pause
this just wont be a simple script for see what do timescale but he do nothing D:??
you have to multiply the velocity by Time.deltaTime:
void Update () {
transform.Translate(new Vector3 (1, 0, 0) * velocità * Time.deltaTime);
}
Setting time.timeScale to 0 doesn’t stop the engine from calling Update(), but it does change the value of Time.deltaTime, also its a good practive to have movement based on velocity multiplied by Time.deltaTime, that way you get what is called “frame rate independent movement”, because you are taking into account the time since the last update.
ohhhhh rly usefull!!it seemed strange that the same pause was called by the update and leaved by it :S, now I understand, influence the delta time! thank you very much: DD