Control animation speed of subtitle

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
jjpixelc
Posts: 44
Joined: Sun Mar 01, 2020 1:04 pm

Control animation speed of subtitle

Post 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?
User avatar
Tony Li
Posts: 22158
Joined: Thu Jul 18, 2013 1:27 pm

Re: Control animation speed of subtitle

Post 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.)
jjpixelc
Posts: 44
Joined: Sun Mar 01, 2020 1:04 pm

Re: Control animation speed of subtitle

Post 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.
User avatar
Tony Li
Posts: 22158
Joined: Thu Jul 18, 2013 1:27 pm

Re: Control animation speed of subtitle

Post 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.
jjpixelc
Posts: 44
Joined: Sun Mar 01, 2020 1:04 pm

Re: Control animation speed of subtitle

Post 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. :-)
User avatar
Tony Li
Posts: 22158
Joined: Thu Jul 18, 2013 1:27 pm

Re: Control animation speed of subtitle

Post by Tony Li »

Hi,

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