Display Placeholder Image When There's No Dialogue

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
dhishii
Posts: 16
Joined: Fri Dec 20, 2019 4:00 am

Display Placeholder Image When There's No Dialogue

Post by dhishii »

Hi,

Is it possible to enable an image on the dialogue panel when there are no conversation and disable it when the dialogue starts?
User avatar
Tony Li
Posts: 21678
Joined: Thu Jul 18, 2013 1:27 pm

Re: Display Placeholder Image When There's No Dialogue

Post by Tony Li »

Hi,

Sure! Add the image to the dialogue panel and leave it enabled. Add a Dialogue System Events component to the Dialogue Manager. Configure the OnConversationStart() event to disable the image. Configure OnConversationEnd() to re-enable it.

If your dialogue UI hides the dialogue panel (that is, if the dialogue panel GameObject is assigned to the Standard Dialogue UI component's Dialogue Panel field), then you must make the image a child of the Standard Dialogue UI GameObject, not the dialogue panel.
dhishii
Posts: 16
Joined: Fri Dec 20, 2019 4:00 am

Re: Display Placeholder Image When There's No Dialogue

Post by dhishii »

Hey Tony,
That worked perfectly!
Thanks!
User avatar
Tony Li
Posts: 21678
Joined: Thu Jul 18, 2013 1:27 pm

Re: Display Placeholder Image When There's No Dialogue

Post by Tony Li »

Glad to help! :-)
dhishii
Posts: 16
Joined: Fri Dec 20, 2019 4:00 am

Re: Display Placeholder Image When There's No Dialogue

Post by dhishii »

Hi Tony,
I had another question regarding this. I were to leave the scene and come back, the dialogue will be displayed over the placeholder image. Do you know if there is a way around this?
User avatar
Tony Li
Posts: 21678
Joined: Thu Jul 18, 2013 1:27 pm

Re: Display Placeholder Image When There's No Dialogue

Post by Tony Li »

Hi,

That suggests that your Dialogue System Events component is on a scene object and the image is on the Dialogue Manager or another persistent object (i.e., an object that survives scene changes). If this is the case, then the Dialogue System Events' reference to the image will be lost when you change scenes. To address this, you'll need to make the image and Dialogue System Events both part of a persistent object or both not part of a persistent object. Either that, or you can write a script to reconnect the reference(s) when the scene loads.
dhishii
Posts: 16
Joined: Fri Dec 20, 2019 4:00 am

Re: Display Placeholder Image When There's No Dialogue

Post by dhishii »

Hi Tony,

That was exactly what we needed. Thank you !
User avatar
Tony Li
Posts: 21678
Joined: Thu Jul 18, 2013 1:27 pm

Re: Display Placeholder Image When There's No Dialogue

Post by Tony Li »

Glad to help!
Post Reply