Page 1 of 1

Control animation speed of subtitle

Posted: Sat Oct 09, 2021 2:55 pm
by jjpixelc
Hi

I'm using the speech bubble prefab in my game and I am struggling to control the animation speed of the speech bubble.
I want the subtitle to show/hide with different speed in different situations and I want to control it from the sequencer.

I have created a float parameter in the animator controller and tied it to the animation speed value (standard Unity method).
I then change this parameter with the in-built AnimatorFloat() sequencer command.
When testing, the animation speed value is successfully changed, but is reset to the original value as soon as animation is over. So the next subtitle is animated with the original speed instead of the new one I just set.
The same happens when I try to use boolean parameters.
I cannot make any parameter values stick after they've been changed via the sequencer.

Is there some code that resets all animation controller parameters all the time?
If so, what's the best way to get around it?

Re: Control animation speed of subtitle

Posted: Sat Oct 09, 2021 3:03 pm
by Tony Li
Hi,

Are you controlling the speed of the bubble subtitle panel's Show and Hide animations? (I'm just trying to get a clear understanding of what you're doing and what your requirements are.)

Re: Control animation speed of subtitle

Posted: Sun Oct 10, 2021 5:22 am
by jjpixelc
Yes, exactly. That's what I'm trying to do.
I guess I could solve it by making a bunch of different Animator Controllers with different animations on them and then change them out as needed with a custom sequencer command.
But just adjusting a speed parameter through the AnimatorFloat() function would be much easier - and give complete control, so I was hoping that could be achieved.

Re: Control animation speed of subtitle

Posted: Sun Oct 10, 2021 9:47 am
by Tony Li
Hi,

Do the subtitle panels get deactivated between lines? By default, Animator components reset their parameters when disabled. You can tell an Animator to keep its current parameter values by setting its keepAnimatorControllerStateOnDisable property to true.

Re: Control animation speed of subtitle

Posted: Tue Oct 12, 2021 12:17 pm
by jjpixelc
Yes, this was exactly the thing I was looking for.
Thanks for this general lesson on Unity functions - your support is above and beyond and I'm happy to say that I'm recommending your product everywhere I go and I have 2 confirmed purchases already. :-)

Re: Control animation speed of subtitle

Posted: Tue Oct 12, 2021 1:09 pm
by Tony Li
Hi,

Thank you! I really appreciate the kind word of mouth.