Adding Text Animation for Certain Dialogue Choices

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Leroy
Posts: 2
Joined: Sat Feb 08, 2025 12:28 am

Adding Text Animation for Certain Dialogue Choices

Post by Leroy »

I want some dialogue options to have a shaking or floating letter effect. I wrote a script that can do this if I attach it to a text object. However, the obvious problem is that when I do this, the plugin takes the object as a template, and all options end up with the effect.

How can I make the script activate the animation for a specific dialogue line when creating the dialogue? I also want to send different commands, making some lines shake and others float etc.

Hope that makes sense!
User avatar
Tony Li
Posts: 22886
Joined: Thu Jul 18, 2013 1:27 pm

Re: Adding Text Animation for Certain Dialogue Choices

Post by Tony Li »

Hi,

I recommend using Text Animator for Unity. The Dialogue System has integration with it.

If you can't do that for some reason, then you can make a subclass of StandardUISubtitlePanel and/or StandardUIResponseButton and override the SetContent() method to enable or disable your script(s) as needed for each subtitle or response text.
Leroy
Posts: 2
Joined: Sat Feb 08, 2025 12:28 am

Re: Adding Text Animation for Certain Dialogue Choices

Post by Leroy »

Thank you for your quick response! Yes, I want to use my own script—I just need to add small effects to certain dialogue lines.

Could you please provide a bit more detail on the structure of such a solution? I override the SetContent() method and add my logic there, but how can I specify that a particular line should have an effect? Should I check for certain keywords in the text, or is there a simpler way to do it?
User avatar
Tony Li
Posts: 22886
Joined: Thu Jul 18, 2013 1:27 pm

Re: Adding Text Animation for Certain Dialogue Choices

Post by Tony Li »

You can either add tags into your dialogue text that you parse out, such as: "Hey, that's <wiggle>tickles</wiggle>." (That's how Text Animator works.)

Or you can add a custom field to your dialogue entry template -- for example, a Boolean field named "Shake". Then check if this field is true, such as:

Code: Select all

bool shake = Field.LookupBool(subtitle.dialogueEntry.fields, "Shake");
GetComponent<ShakeScript>().enabled = shake;
Post Reply