NGUI Setup question

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Bluerex
Posts: 4
Joined: Mon Jan 18, 2016 11:56 pm

NGUI Setup question

Post by Bluerex »

Hi,

I have a few questions... my game uses NGUI and I've got the dialog system working with it, but my response buttons are unclickable. Also, the NPC conversation text disappears when it comes time to respond... how do I make it persist?

Here's some screenshot info for you so you can see my setup:

Image
This is the setup I'm using

Image
This is the runtime

Any help is appreciated.
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: NGUI Setup question

Post by Tony Li »

Hi,

On your NGUI Dialogue UI component:

1. Expand Response Menu.

2. Assign your NPC Panel and NPC Subtitle UI elements to the Subtitle Reminder section. So NPC Panel and NPC Subtitle will be doubly-assigned to NPC Subtitle and Response Menu > Subtitle Reminder. The Dialogue System shows the NPC Subtitle when delivering a line of dialogue. When showing a response menu, it hides the NPC Subtitle and shows the Subtitle Reminder. If the same UI elements are assigned to both, the net effect is that they remain visible.

3. Assign your buttons to the Buttons list if they're not already assigned. If the buttons still aren't clickable, pause the game while the response menu is visible. Inspect one of the buttons to see if the inspector gives you any insight into why the button isn't clickable.

Do the buttons look disabled, or do they look enabled but you just can't click on them? If they look enabled, maybe another invisible UI element is on top of them, blocking mouse clicks.

If you get stuck, please feel free to send an example project to tony (at) pixelcrushers.com. I'll be happy to take a look!
Bluerex
Posts: 4
Joined: Mon Jan 18, 2016 11:56 pm

Re: NGUI Setup question

Post by Bluerex »

Ok I've made some progress. The camera needed to be set to 3d World for the button clicks to register, which I have working now. I've also got the NPC Subtitle text working.

My only issue now is that the response buttons OnClick events aren't being set to anything. I assumed this would be set with the Response Button Script, but it isn't. The script is changing the button label though so I know it's hooked up correctly.

So do I have to manually handle the button OnClick event, or is the Response Button script supposed to set it for me?
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: NGUI Setup question

Post by Tony Li »

Hi,

NGUI automatically calls OnClick on any scripts on a button (such as the NGUI Response Button script). You don't need to manually add a handler.

Are there any warnings in the Console view, such as "You can't place widgets on a layer different than the UIPanel that manages them"? This will make a button unclickable, since NGUI only checks the UIPanel's layer.

Does the example scene work? (Dialogue System/Third Party Support/NGUI/Example/Feature Demo Using NGUI)

As another test, temporarily add another UIButton to your dialogue UI. Don't associate it with any fields in the NGUI Dialogue UI component. When you start a conversation, you should be able to click this button. It won't do anything, but you should still be able to click it. If you can't, then try to identify why it's not clickable -- maybe the layers are wrong (check the layers on your NGUI camera's Camera and UICamera components), maybe a transparent UIPanel is on top of it blocking clicks, etc. Once you get it to be clickable, the response buttons will probably also be clickable.
Post Reply