"One of Unity game development" Time.timescale=0 play animation in the event of a paused game

Source: Internet
Author: User

Prerequisites: The game is paused with Time.timescale =% in the project

issue: after pausing the game, the button that pauses the interface may need to play an idle animation, time.timescale=0 will affect the animation playback.


Factors affected by Time.timescale:

1. Physical simulations. Fixedupdate-When time.timescale=0, the Fixedupdate function is not executed.

2.Coroutines. -The Time.timescale=0 function does not stop, but it stops waitforseconds. The covariant function still triggers every frame, but Waitforseconds uses the current time.deltatime to become 0.

3.Invoke and invokerepeating. -The specified function is dropped after a delay of some time.

4.Particle system particle systems.

5.Animations. Animation. If we are using animator, we can set the effect of animation ignoring Time.timescale. Just set the UpdateMode to Unscaled time, set as follows:



Factors not affected by Time.timescale:

1.update-time.timescale does not affect the call to update, and update is always called. But if time.deltatime=0, the following implementations will not work:

function Update () {    //Move the object meters per second!    var translation = Time.deltatime *;    Transform. Translate (0, 0, translation);}
The 2.ongui-ongui and corresponding event implementation principles are not based on time.timescale and are therefore unaffected.


Reference:

    • Http://gamedevdocket.blogspot.com
    • http://answers.unity3d.com/
    • https://unionassets.com/blog/playing-animation-with-time-timescale-0-339

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

"One of Unity game development" Time.timescale=0 play animation in the event of a paused game

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.