Hi there!
At first sorry for my English.
—
In our project we use some plugins that turn on animations in “parallel thread”, for example “Color blink” for an object.
I want to rewind back and forth to the particular chapters in my Slate cutscene. But if my color blink effect started it don’t stop until it finish even if I rewind cutscene to the before “color blink states”. And this situation touches all animations that execute through some time.
—
How can I properly stop and revert all changes that animations make in particular cutscene?
I want to implement “Chapters menu” that allow users to go to the particular place in a cutscene.
Hello!
No problem. Your English is fine. 🙂
Can you please explain a bit more, how is the code responsible for the animation that you want to revert (Color Blink) is being called from within Slate? Have you made a custom action clip to do that, or by some other means?
Yes, you’re right. I use custom action clip to do that.
—
My component inherits from ActorActionClip.
for example I want 6 sec blink animation:
1. I use OnEnter() method in my class where I just animate color through an animation engine with DOColor method.
2. I put my custom clip where I want in the cutscene and when its time OnEnter() executes on that custom clip.
When I jump to another section (when I’m on a clip OnEnter starts) it jumps, but that blinking blinks that 6 (real) seconds independent where I am in the time line.
Hello again,
Well, using a tween engine is not a very good practice to do within a sequencer like Slate, because the tween will run completely independent (or like you said “on a different thread”) than the sequencer does, especially if it’s just a “fire and forget”. So, you will need to tell DOTween to kill the tween. Bellow is an example how you should do it.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
publicclassBlinkColor:ActorActionClip{
[SerializeField]
privatefloat_length=1f;
publicColor color;
privateTween tween;
publicoverridefloatlength{
get{return_length;}
set{_length=value;}
}
protectedoverridevoidOnEnter(){
tween=actor.DOColor(color,length);
}
protectedoverridevoidOnExit(){
tween.Kill();
}
}
On the other hand, you can of course just use the included action clip “Animate Material Color” and keyframe the color over time exactly like you want 🙂