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!
Adding Text Animation for Certain Dialogue Choices
Re: Adding Text Animation for Certain Dialogue Choices
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.
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.
Re: Adding Text Animation for Certain Dialogue Choices
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?
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?
Re: Adding Text Animation for Certain Dialogue Choices
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:
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;