Home > other >  How to use Time. The timeScale=0 realize game suspension function
How to use Time. The timeScale=0 realize game suspension function

Time:09-28

After press the pause button, why only perform the update method, does not perform the start method

CodePudding user response:

Void the Start () {}//methods: runs only once (close the script at startup or not run, if the script was removed on added to objects will still run once), mainly used for initialization,

Time. The timeScale=0 is to adjust the game speed, when 0 and banned the general look, but it will not affect the life cycle of the script, so according to the characteristics of the Start method, unless the destruction of the script to add, because otherwise it will not run on a game object for the second Time,

And the Update is performed per frame,

If there are any help, please, thank you!

The commonly used method of life cycle:
Void the Start () {}//methods: runs only once (close the script at startup or not run, if the script was removed on added to objects will still run once), mainly used for initialization,
Void the Update () {}//methods: every frame, but the time consumption of each frame is not fixed,
Void Awake () {}//methods: runs only once (close the script at startup or not run, if the script removed on added to objects will still run once), but even earlier than the Start,
Void OnEnable () {}//methods: whenever a script is up and running time,
Void OnDisable () {}//methods: when the scripts are disabled or hidden execution (the script will be destroyed before the first disabled in the destruction of objects so destroyed a script or execute)
Void OnDestroy () {}//methods: when the script will be removed after the execution will perform (script has been removed, the object is destroyed),
Void LateUpdate () {}//methods: later Update events, calls per frame, later than the Update step, behind the Update will have, and you don't write unless
Void FixedUpdate () {}//methods: the fixed update events, has been performed, once every 0.02 seconds, all of the updated physical components processing here,

CodePudding user response:

references on 1/f, deep and remote wind's response:
void the Start () {}//methods: runs only once (close the script at startup or not run, if the script removed on added to objects will still run once), mainly used for initialization,

Time. The timeScale=0 is to adjust the game speed, when 0 and banned the general look, but it will not affect the life cycle of the script, so according to the characteristics of the Start method, unless the destruction of the script to add, because otherwise it will not run on a game object for the second Time,

And the Update is performed per frame,

If there are any help, please, thank you!

The commonly used method of life cycle:
Void the Start () {}//methods: runs only once (close the script at startup or not run, if the script was removed on added to objects will still run once), mainly used for initialization,
Void the Update () {}//methods: every frame, but the time consumption of each frame is not fixed,
Void Awake () {}//methods: runs only once (close the script at startup or not run, if the script removed on added to objects will still run once), but even earlier than the Start,
Void OnEnable () {}//methods: whenever a script is up and running time,
Void OnDisable () {}//methods: when the scripts are disabled or hidden execution (the script will be destroyed before the first disabled in the destruction of objects so destroyed a script or execute)
Void OnDestroy () {}//methods: when the script will be removed after the execution will perform (script has been removed, the object is destroyed),
Void LateUpdate () {}//methods: later Update events, calls per frame, later than the Update step, behind the Update will have, and you don't write unless
Void FixedUpdate () {}//methods: the fixed update events, has been performed, once every 0.02 seconds, all of the updated physical components processing here,

How to adopt????????????????

CodePudding user response:

refer to the second floor Aieng55 response:
Quote: reference, 1/f, deep and remote wind month response:
void the Start () {}//methods: runs only once (close the script at startup also won't run, if the script removed on added to objects will still run once), mainly used for initialization,

Time. The timeScale=0 is to adjust the game speed, when 0 and banned the general look, but it will not affect the life cycle of the script, so according to the characteristics of the Start method, unless the destruction of the script to add, because otherwise it will not run on a game object for the second Time,

And the Update is performed per frame,

If there are any help, please, thank you!

The commonly used method of life cycle:
Void the Start () {}//methods: runs only once (close the script at startup or not run, if the script was removed on added to objects will still run once), mainly used for initialization,
Void the Update () {}//methods: every frame, but the time consumption of each frame is not fixed,
Void Awake () {}//methods: runs only once (close the script at startup or not run, if the script removed on added to objects will still run once), but even earlier than the Start,
Void OnEnable () {}//methods: whenever a script is up and running time,
Void OnDisable () {}//methods: when the scripts are disabled or hidden execution (the script will be destroyed before the first disabled in the destruction of objects so destroyed a script or execute)
Void OnDestroy () {}//methods: when the script will be removed after the execution will perform (script has been removed, the object is destroyed),
Void LateUpdate () {}//methods: later Update events, calls per frame, later than the Update step, behind the Update will have, and you don't write unless
Void FixedUpdate () {}//methods: the fixed update events, has been performed, once every 0.02 seconds, all of the updated physical components processing here,

How to adopt?????

Don't know how to delete the previous posts and how to adopt
  • Related