ITimeline interface

Makihiro 5 months ago • updated by Lazlo Bonin (Lead Developer) 2 months ago 6

I feel inconvenienced not to treat Timeline and TimelineChild in the same way.

I need an ITimeline interface that can handle Timeline and TimelineChild in the same way.

Chronos Version:
Unity Version:

Why not use TimelineEffector that is the parent of those 2 objects instead?

The TimelineEffector can access ComponentTimeline.

But properties such as deltaTime and timeScale can not be accessed.

Oh, I see. I didn't notice that before.

You can cache timeline = GetComponentInParent<Timeline>(); as a makeshift to get any properties to avoid if-else.

But in this case, I agree with you that the interface is perfectly convenience.

P.S. In fact, I'm still curious what or when to use TimelineChild. In RewindableParticleSystemTimeline, it finds all particleSystems in children but use GetComponent<Timeline>.

Yes, I currently use that solution.

Why does not RewindableParticleSystemTimeline reference TimelineChild?

Since TimelineChild inherit TimelineEffector, it affects the various components attached to that GameObject.

This is the same as TImeline as it is an implementation of TimelineEffector, but because TimelineChild internally only return the parent Timeline, extra variables are eliminated.

Ah, thank you for the explanation. I now get that why TimelineChild implements that way.

At first, I bring out RewindableParticleSystemTimeline topic because I think ITimeline interface will help this too. But it's turned out to be my misunderstanding.


Hi everyone, very sorry for the late reply on this.

To clarify, TimelineEffector is a base class that takes any measurement you provide it and actually applies them to the Unity components.

Timeline is a TimelineEffector that provides its own measurements.

TimelineChild is a TimelineEffector that provides the measurements from its parent timeline. It is not an "independent" timeline, it's just a "proxy" to the parent timeline. If you need to access any property that's parent-only, just use TimelineChild.parent.