Conversation Events not working on Non Instanced Dialogue UI

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
SystemId
Posts: 30
Joined: Thu Aug 08, 2019 1:31 pm

Conversation Events not working on Non Instanced Dialogue UI

Post by SystemId »

Hello, Sorry to bug you.. I've tried looking around and couldn't really find this scenario in the forums.

I've ran into a situation where I don't want to use an Instanced Prefab for my Dialogue UI. Right now I made it a Child of the Dialogue Manager instead, and dragged this child game object into the Dialogue UI slot in the Manager.

When I talk to my NPCs, the conversations start like normal, except the Conversation Events I setup to stop player movement / input no longer work. This would go back to normal if I set the Dialogue UI to be a prefab, rather than a child game object. Are conversation events not being called if I don't have the Dialogue UI as a Prefab?
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

Re: Conversation Events not working on Non Instanced Dialogue UI

Post by Tony Li »

Hi,

I suspect it's coincidental and unrelated.

Conversation events are called on these recipients.

If you've put the event script (e.g., Dialogue System Events component) on the player GameObject, make sure the player GameObject is being used as the conversation actor or conversation conversant. For example, assign the player GameObject to the Dialogue System Trigger's Conversation Actor field, or add a Dialogue Actor component to the player and set the Actor dropdown to Player.
SystemId
Posts: 30
Joined: Thu Aug 08, 2019 1:31 pm

Re: Conversation Events not working on Non Instanced Dialogue UI

Post by SystemId »

This is really strange because my problem only occurs when my Dialogue UI is not from a Prefab. I didnt think it was related, but I really cant explain why it just stopped working after doing the 1 step.

I setup some Debug Logs to track my controls being enabled / disabled. They work just fine when the Dialogue UI is a prefab. Once I drag the Prefab in as a Child of the Dialogue Manager, and assign that to the Dialogue UI, the problem comes back.

I can start a conversation, and it recognizes the Player (Having a Dialogue Actor) , and the NPC (Also having a Dialogue Actor) and runs the correct conversation using what is set in the Dialogue System Trigger , but the on conversation Start and End events are not being performed. They work again if I drag the Prefab directly into the Dialogue UI in the Dialogue Manager.
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

Re: Conversation Events not working on Non Instanced Dialogue UI

Post by Tony Li »

Is the prefab is being instantiated into a different canvas that when you manually add an instance?

In DS version 2.2.15, you can specify which canvas to instantiate the prefab into, if that helps.

Can you send a reproduction project to tony (at) pixelcrushers.com?
SystemId
Posts: 30
Joined: Thu Aug 08, 2019 1:31 pm

Re: Conversation Events not working on Non Instanced Dialogue UI

Post by SystemId »

hmm .. yes this is the case.
Normally the prefab is instantiated under the Canvas that's a child to the Dialogue Manager.

The reason I did not want to instantiate the Dialogue UI was because I wanted my Dialogue UI to be on its own Canvas.
I had my portraits under a different Canvas because I wanted my portraits to be affected by post processing, and not my actual dialogue boxes.

I will try to see if I can replicate the problem in a small project, because my current project is too big to submit.
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

Re: Conversation Events not working on Non Instanced Dialogue UI

Post by Tony Li »

Sounds good.

It's completely fine to have the dialogue UI under a different canvas. The Dialogue System only calls conversation events on GameObjects in the Dialogue Manager's hierarchy and the participants' hierarchies. If you're depending on a conversation event to reach a dialogue UI that's not part of the Dialogue Manager's hierarchy, you may need to move that event handler to the Dialogue Manager or one of the participants. To check which GameObjects are being used as the participants, set the Dialogue Manager's Debug Level to Info. When the conversation starts, look for a line like:

Dialogue System: Starting conversation 'Title' with actor=X and conversant=Y

X and Y are the participants.
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

Re: Conversation Events not working on Non Instanced Dialogue UI

Post by Tony Li »

Hi Gary,

Thanks for sending the reproduction project. I replied to your email. Standard Dialogue UI must be inside the hierarchy of a Canvas component. I included a more detailed explanation in the email, but the short answer is to add a Canvas component:

canvasRequired.png
canvasRequired.png (16.21 KiB) Viewed 298 times

You can leave Canvas_MainUI and Canvas_Portraits as nested canvases inside the dialogue UI's hierarchy, or you can move them out as shown in the screenshot above.
Post Reply