Set conversation/UI from button click

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Trashrat
Posts: 25
Joined: Fri Oct 13, 2023 11:38 am

Set conversation/UI from button click

Post by Trashrat »

Hey,

So i'm trying to work a few things currently, and maybe just not having a complete understanding of how the canvas and dialogue manager interact with each other is holding me back.

Curently I am trying to have a menu thathas an option to take the player to three other screens. One doesn't need the dialogue system so is just enabling a new panel. Another screen, taking the player to emails let's say, will need the dialogue manager.

I currently have it set up so that it triggers a conversation on an empty game object, but the UI for that conversation isn't appearing. Any help would be greatly appreaciated thank you.
Attachments
Profile.JPG
Profile.JPG (25.01 KiB) Viewed 1212 times
CommsButton.JPG
CommsButton.JPG (105.82 KiB) Viewed 1212 times
CommDialogue.JPG
CommDialogue.JPG (99.66 KiB) Viewed 1212 times
User avatar
Tony Li
Posts: 21925
Joined: Thu Jul 18, 2013 1:27 pm

Re: Set conversation/UI from button click

Post by Tony Li »

Hi,

If I understand you correctly, you want conversations involving the computer to use a different dialogue UI from the default dialogue UI assigned to the Dialogue Manager's Display Settings > Dialogue UI field, correct?

(If you want all conversation to use this dialogue UI by default, assign it to the Dialogue Manager's Dialogue UI field.)

If that's correct, does the computer exist in only one scene, or is it available regardless of the current scene?

If the computer exists in only one scene, set it up like this:
  • Put your computer-specific dialogue UI in a Canvas in a GameObject in the scene. This dialogue UI should have a fully-configured Standard Dialogue UI component. (See Dialogue UIs.) Alternatively, save the computer-specific dialogue UI as a prefab.
  • Put your computer GameObject in the scene. Add an Override Dialogue UI component to the GameObject. Assign the dialogue UI to it (either a scene instance or a prefab).
  • In your Dialogue System Trigger, assign the computer GameObject as the Conversation Conversant.
If the computer is available in all scenes, do the same as above except:
Trashrat
Posts: 25
Joined: Fri Oct 13, 2023 11:38 am

Re: Set conversation/UI from button click

Post by Trashrat »

I there and thanks for the response. I think that my issue is more that the panel that takes the player to the new dialogue UI isn't a dialogue UI, it is just a canvas.

I have attached the image of it's current state below. The middle button is to take the player to a new UI, that will display a conversation. Whilst the left button will take the player to a new panel that will just show static information.
Attachments
UIscreen.JPG
UIscreen.JPG (51.7 KiB) Viewed 1208 times
User avatar
Tony Li
Posts: 21925
Joined: Thu Jul 18, 2013 1:27 pm

Re: Set conversation/UI from button click

Post by Tony Li »

Hi,

Got it. Add a Dialogue System Trigger component to the Communications button. Configure the Button component's OnClick() event to call the Dialogue System Trigger's OnUse:

buttonOnUseTrigger.png
buttonOnUseTrigger.png (33.15 KiB) Viewed 1208 times
Trashrat
Posts: 25
Joined: Fri Oct 13, 2023 11:38 am

Re: Set conversation/UI from button click

Post by Trashrat »

Hi Tony,

Thanks for getting back to me so quickly. That makes sense, but unfortunately my "computer UI" Isn't appearing OnUse. I have the Canvas in the dialogue manager, the UI for the computer as a child below it, and those peices all together in the inspector. (I can use my terminal UI in the Dialogue UI as it is the only dialogue UI being used can't I?)

In my other canvas, which is really just a game menu, on the Communications button I have my trigger, and my onClick event, but the UI unfortunately isn't appearing, although i know the conversation is taking place.

Sorry for the trouble and thank you again.
Attachments
TerminalProfile.JPG
TerminalProfile.JPG (30.82 KiB) Viewed 1207 times
DialogueManager.JPG
DialogueManager.JPG (112.1 KiB) Viewed 1207 times
CommsButton.JPG
CommsButton.JPG (94 KiB) Viewed 1207 times
Trashrat
Posts: 25
Joined: Fri Oct 13, 2023 11:38 am

Re: Set conversation/UI from button click

Post by Trashrat »

Hi there, at the moment I have now managed to get this to work. I deleted the Dialogue Manager, added it again and then added a prefab of the Terminal Dialogue UI to the Manager and now it appears to be working. Thank you for your help again.
User avatar
Tony Li
Posts: 21925
Joined: Thu Jul 18, 2013 1:27 pm

Re: Set conversation/UI from button click

Post by Tony Li »

Hi,

Great! From reading through your last post, I think that's all that was needed. If you need to use multiple dialogue UIs in the future and have questions, just ask and I'll do my best to help.
Post Reply