0
Answered

pausing the time without the animation in a certain points

Mohamed Adel 3 years ago updated by Lazlo Bonin (Lead Developer) 3 years ago 1

Hi,

 I need to pause the clock by assign localtime to zero, but without pausing the animator too.

This will be in a special states only, not in general, so I want to make it from the code, if possible.

Chronos Version:
2.2
Unity Version:
2017.2.0f3
Answered

Hi Mohamed,

There is no built-in way to disable Chronos on only some components.

If you want, you can edit the Source/Timelines/AnimatorTimeline.cs file to add an public bool enabled field, and use this field to ignore the timescale inside the AdjustProperties method.

public bool enabled = true;
public override void AdjustProperties(float timeScale)
{
    if (!enabled)
    {
        return; 
    }
    if (timeScale > 0)
    {
        component.speed = speed * timeScale;
    }
    else
    {
        component.speed = 0;
    }
}

Then, you would be able to use:

GetComponent<Timeline>().animator.enabled = false;