0

ITimeline interface

Makihiro 3 months ago • updated by Lafsody@UrniqueStudio 2 months ago 5

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.