Page 1 of 1
World Space Continue Button
Posted: Tue Sep 26, 2017 9:40 am
by OneManOnMars
Hey,
I would like to change from the standard dialog UI to a world space dialog UI with speech bubbles. I found the documentation and added the Speech Bubble Dialogue UI to the Canvas and the Speech Bubble Canvas to the NPC. It works but the continue button is missing so I can only read the first sentence. How can I add this to the speech bubble version?
Thank you for your help.
Re: World Space Continue Button
Posted: Tue Sep 26, 2017 9:57 am
by Tony Li
Hi,
You can add a continue button to the canvas yourself. Here are the steps:
1. Add a UI button.
2. Assign it to the dialogue UI's Continue Button field(s), or to the Override Dialogue Controls component if that's what you're using.
3. Hook up the UI button's OnClick() event to call the dialogue UI's OnContinue method (UnityUIDialogueUI.OnContinue). Or add a Continue Button Fast Forward component to the button and point the UI button's OnClick() method to its OnFastForward method instead. If you're using Continue Button Fast Forward, take a look at the generic dialogue UI to see how it's set up.
Re: World Space Continue Button
Posted: Sat Oct 07, 2017 8:33 am
by OneManOnMars
Thank you, Toni, for your helpful response.
I almost have it working.
In fact, it works with normal conversations.
But I stumbled upon two different scenarios where the standard UI gets triggered.
My first example is I have a conversation between two characters and the player.
So there is Thalin and Rosa talking to each other and the player just stands next to them an listens what they are talking about.
Rosa has a Conversation Trigger (on use), a Usable script and a box collider 2D as components. And this triggers the conversation as it did before I changed to speech bubble UI. But not using the bubbles.
Thalin has just the SpeechBubble Canvas attached to her.
The second example is I do have a conversation that is triggered not by a conversation trigger but by a sequence using this command:
SendMessage(OnUse,,Chase01ConvStarter).
In this case, I am not sure where to place the speech bubble canvas. I tried to put it to the character that is listed in the Sequence trigger as speaker. But there is nothing on the character that would mark it as conversant.
I figure these problems are very similar and have the same cause but I can not figure out what it is.
The other question I do have how can I maximize the width of the speech bubble? Right now it is always as long as the text. But it would be better if I could tell it to break at on point and start a new line.
I use the speech bubble Canvas from your example with changed art and a continue button added.
Thank you for your support.
Re: World Space Continue Button
Posted: Sat Oct 07, 2017 11:24 am
by LoydLem
OneManOnMars wrote: ↑Tue Sep 26, 2017 9:40 am
Hey,
I would like to
start using Trenorol from the standard dialog UI to a world space dialog UI with speech bubbles. I found the documentation and added the Speech Bubble Dialogue UI to the Canvas and the Speech Bubble Canvas to the NPC. It works but the continue button is missing so I can only read the first sentence. How can I add this to the speech bubble version?
Thank you for your help.
This is just what I've been looking for. Thanks for help Tony.
Re: World Space Continue Button
Posted: Sat Oct 07, 2017 11:36 am
by Tony Li
Hi,
Here's an example scene that may be helpful (exported from Unity 5.6.0):
WorldSpaceBubbleUIExample_2017-10-07.unitypackage
OneManOnMars wrote:...I stumbled upon two different scenarios where the standard UI gets triggered.
My first example is I have a conversation between two characters and the player.
So there is Thalin and Rosa talking to each other and the player just stands next to them an listens what they are talking about.
Rosa has a Conversation Trigger (on use), a Usable script and a box collider 2D as components. And this triggers the conversation as it did before I changed to speech bubble UI. But not using the bubbles.
Thalin has just the SpeechBubble Canvas attached to her.
I used the basic speech bubble scene, which means it's in 3D. But the same applies to 2D. I created two NPCs and added the bubble canvas to both. (Make sure the bubble canvas has an Override Unity UI Dialogue Control script.)
Then I created a trigger collider object named "Thalin Rosa Conversation Trigger". I assigned Thalin as the Actor and Rosa as the Conversant, and that's the key. For efficiency, the Dialogue System only looks for overrides on the assigned Actor and Conversant. If you were to unassign Rosa from the Conversant field, her lines would use the default (non-bubble) UI. I'm evaluating the impact of looking for overrides on all characters involved in the conversation. It looks like it won't have much impact, so I'll probably include it in a patch coming out at the end of next week.
OneManOnMars wrote:The second example is I do have a conversation that is triggered not by a conversation trigger but by a sequence using this command:
SendMessage(OnUse,,Chase01ConvStarter).
In this case, I am not sure where to place the speech bubble canvas. I tried to put it to the character that is listed in the Sequence trigger as speaker. But there is nothing on the character that would mark it as conversant.
The example scene also has a cube named "SendMessage Sequence Trigger" near Private Hart that has a Sequence Trigger. It has this sequencer command: SendMessage(OnUse,,Private Hart/AI), which sends OnUse to Private Hart's preconfigured Conversation Trigger.
OneManOnMars wrote:The other question I do have how can I maximize the width of the speech bubble? Right now it is always as long as the text. But it would be better if I could tell it to break at on point and start a new line.
This is a matter of fiddling with Unity UI. In the example scene, I set it up like this:
- Speech Bubble Canvas With Menu
- Max Size Panel: Horizontal Layout Group that doesn't expand children, Layout Element with min/preferred sizes set and Flexible Width/Height set to 0. On Hart, I left this panel's background image visible so you can see its extent.
- Bubble Panel: Vertical Layout Group that doesn't expand children, Layout Element that sets min sizes.
- Subtitle Line, etc., as children.
Note that I
removed the Content Size Fitters to prevent them from expanding the lines to their full single-line widths.
Re: World Space Continue Button
Posted: Sat Oct 07, 2017 11:37 am
by Tony Li
LoydLem wrote:This is just what I've been looking for. Thanks for help Tony.
Glad it's useful! Like everything related to Unity UI, it does sometimes take a bit of playing around to get Unity's layout to look the way you want, as indicated in my post above.
Re: World Space Continue Button
Posted: Sun Oct 08, 2017 9:15 am
by OneManOnMars
Hi Tony,
thank you so much - your answer was perfectly helpful!
I think the biggest issue was that I did not know how the dialogue system identifies the actor. So I always thought it is via the conversation trigger. But this seems not to be the case. The speech bubble did not work for actors that had not been properly assigned here:
And I guess the GameObject name.
Thank you for creating a demo scene this was extremely helpful.
And I had to laugh when I saw the two soldiers chatting
And thanks for explaining Unity UI, it is still a big riddle to me, but with some testing, I could make it work.
Re: World Space Continue Button
Posted: Sun Oct 08, 2017 10:14 am
by Tony Li
"You're welcome, Rosa!"
(Nice-looking scene, by the way!)