Search Unity

Time.timeScale best practices

Discussion in 'Scripting' started by TheAlchemist42, Jul 15, 2009.

  1. TheAlchemist42

    TheAlchemist42

    Joined:
    Apr 17, 2008
    Posts:
    68
    Hi. I am working on a project where we commonly speed up/slow down the animations on the screen using Time.timeScale. I have noticed that sometimes (fairly random-seeming), when things are running very fast, like timeScale over 10, certain things are failing.

    One of the obvious things that I have found is that messages that are sent with BroadcastMessage() will occasionally get missed. There are multiple scripts listening for these messages, and sometimes one or more of them will fail to receive or act upon the message. Therefore, I guess that the message is being sent, but for some reason, it is not getting received.

    Another issue is that some of the animations which are run using Animation.Play() or Animation.PlayQueued() either do not play at all or only play partially. So, a model that has a 10 frame animation will almost always play all 10 frames. But sometimes it will stop at frame 3 (or any other frame).

    Has anyone seen problems like these? More specifically, is there any way to avoid them or work around them (apart from not speeding up the timeScale which is not an option)