Switching dialogue UI graphics based on different actor? 2 Questions.

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
NickPo
Posts: 2
Joined: Sat Jun 24, 2017 2:01 pm

Switching dialogue UI graphics based on different actor? 2 Questions.

Post by NickPo »

I hope this question and explanation will make sense... So here it goes, 2 questions.

1. My current dialogue UI box graphically has a slot for the actor's name; I wanted to know, is there a way to have it switch to my graphic without a name slot if I have a certain actor's name (Which would be blank in this instance)? I would be using this instance as a way for the game to have actor less dialogue, eg. the game telling you something like "You hear shouting in the distance".

2. I was also wondering if that idea could be extended further to having different characters having different dialogue box graphics. So eg. If the character speaking is a computer, it would switch from the default dialogue UI Box graphic to a computer screen UI box graphic, or if it is a slime monster character, it'd switch from the default graphic to a slime UI graphic and etc.

For question/problem 1, I tried using an alert, but I couldn't figure out how to replicate the "disappear only when continued is pressed" and "fast forward the typewriter effect when 'continue' is hit.

My programming isn't the best, and I couldn't find any forums, so any advice, help, or starting points would be amazing!
Thank you!
User avatar
Tony Li
Posts: 22062
Joined: Thu Jul 18, 2013 1:27 pm

Re: Switching dialogue UI graphics based on different actor? 2 Questions.

Post by Tony Li »

Hi,

It sounds like an alert would be best for #1. Here's an example scene (exported in Unity 5.6): AlertWithContinueExample_2017-07-09.unitypackage

I took these steps to set it up:

1. The scene uses the generic UI. I added a typewriter effect to the Alert Line.

2. The Alert Panel has an inactive Continue Button. I enabled it and added a Unity UI Continue Button On Fast Forward component.

3. I pointed the continue button's OnClick() event to call UnityUIContinueButtonFastForward.OnFastForward.

An Alert Trigger shows a long alert at start. I set the Duration to 9999 seconds -- effectively forever, so it waits for the continue button.


For #2, add an Override Dialogue UI to the NPC, and assign a different dialogue UI. This will swap out the entire dialogue UI when talking with this NPC. In the example scene, the Dead Guard and Terminal both use this component.

If you only want to swap out the NPC's specific subtitle elements, use these steps instead:

1. Inspect your main dialogue UI, and tick Find Actor Overrides (all the way at the bottom of the inspector).

2. Add an Override Unity UI Dialogue Controls component to the NPC (or a child GameObject). Then assign the specific UI elements that you want to override, such as the NPC's subtitle panel and subtitle line.
NickPo
Posts: 2
Joined: Sat Jun 24, 2017 2:01 pm

Re: Switching dialogue UI graphics based on different actor? 2 Questions.

Post by NickPo »

Toni,

I looked at the example and tried both of them out and it works perfectly!

Thank you so much!
User avatar
Tony Li
Posts: 22062
Joined: Thu Jul 18, 2013 1:27 pm

Re: Switching dialogue UI graphics based on different actor? 2 Questions.

Post by Tony Li »

Happy to help!
Post Reply