Sunday, June 15, 2014

Factors affected and not affected by Time.timeScale

List of factors affected by Time.timeScale,


1. Coroutines
2. Invokes and InvokeRepeating
3. All physics related simulations (FixedUpdate())
4. Animations
5. Particle System

    To make it working, timeScale must be great than 0.0f. It would work even if it is set to 0.001f, Thought to run it on normal repeating rate, you should go for some short of simple logic,

For instance,
    If you want to work Animation even after timeScale is set to 0.001f, you should set animation speed to 0.001f / Time.timeScale. So it will go with regular frame rate.


List of factors doesn't affected by Time.timeScale,


1. Update()
    Time.timeScale will not make any affect on Update call, it will invoked as per the frame rate until and unless it is not used in any statement for computation.

For example,
float distance = Time.timeScale * 10.0f;
transform.Translate (0, 0, distance); 

will make affect on movement as Time.timeScale is being used while making object movement. It is moving object 10m/second.


while,
float distance = 10.0f;
transform.Translate (0, 0, distance); 

will not make any affect of timeScale on object movement and moving object  10m/frame instead.


2. OnGUI()
    OnGUI and its event have overlaying architecture over Time.timeScale, so it won't be affected if it goes to lower or set to 0.


Also see,

No comments:

Post a Comment

Popular Posts