Can't seem to get 4.6 Unity UI to work

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
NashFM
Posts: 8
Joined: Mon Dec 15, 2014 12:41 am

Can't seem to get 4.6 Unity UI to work

Post by NashFM »

Hi, sorry I've been posting so many questions.  Your help and support has been amazing, and I'll make sure to rate you 5 stars!  I also apologize as this question is quite specific to me, and so probably won't be useful for other forum readers.



I've been trying to make a new UI from scratch using 4.6 as per the instructions on this page - http://www.pixelcrushers.com/dialogue_s ... e_u_i.html



However, I can't get it to work.  When I trigger a dialog, I just get a blank panel.  I know the dialog is working, since any pre-made ones in your package all work fine.  I've used the example 4.6 UI stuff, and it works out of the box, but my own design is too different design-wise for me to "tweak" it to my use, so I'm building one from scratch.



I'm not sure what I'm doing wrong, and I'm not sure where to turn.  Is there a way I can share my project with you?  Either by literally sending you the project, or screenshots, or even just a detailed description?



Thanks again!
User avatar
Tony Li
Posts: 21020
Joined: Thu Jul 18, 2013 1:27 pm

Can't seem to get 4.6 Unity UI to work

Post by Tony Li »

Hi,



I'll be happy to take a look at the project. You can email it to tony (at) pixelcrushers.com. If it's too big for email, send me a download link or email me for access to the Pixel Crushers FTP site.



Also feel free to post screenshots of the scene hierarchy (the UI/canvas stuff in particular) and the inspector view of the UnityUIDialogueUI component.
User avatar
Tony Li
Posts: 21020
Joined: Thu Jul 18, 2013 1:27 pm

Can't seem to get 4.6 Unity UI to work

Post by Tony Li »

We took care of this over email. I'm just posting a couple notes here in case others have the same question.



We made these changes:



1. Assigned Dialogue > Response Menu > Button Template Holder. The Button Template Holder needs to be assigned because it's the parent that template buttons are added to. If it's not assigned, the dialogue UI doesn't know where to put instantiated response buttons.



2. Added a Layout Element to Button Response Template. This allows the layout component on the Button Template Holder to format the layout of its children (the buttons).



3. On the Dialogue UI, unassigned Dialogue Panel from NPC Subtitle > Panel, PC Subtitle > Panel, Subtitle Reminder > Panel, since Dialogue Panel is already assigned to Dialogue > Panel.



4. Duplicated the UI objects under Dialogue Panel to give each section (NPC Subtitle, NPC Subtitle Reminder, and PC Subtitle) their own unique controls. It was a bit of overkill, but I wanted to eliminate any issues where two sections might be fighting for control of the same UI object.



The response panel was configured as a world space canvas, which is fine. All of the panels can be world space if you want to tie them to different elements in the game world.



If you want to change the dialogue panel to world canvas(es) on the conversation participants, you can add an OnConversationStart(Transform actor) method to a script on your Dialogue Manager or player GameObject (see Script Messages). You can reference the properties DialogueManager.CurrentActor (the player) and DialogueManager.CurrentConversant (the NPC) to know which GameObjects to parent the world canvases to (See DialogueManager API). In this case, Dialogue Panel will just be an empty panel. Assign the world canvas panels to NPC Subtitle > Panel, PC Subtitle > Panel, and NPC Subtitle Reminder > Panel.
Post Reply