SOLVED: Hide text after response was selected in transparent dialogue UI

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Thistis
Posts: 27
Joined: Sat Oct 05, 2019 5:05 pm

SOLVED: Hide text after response was selected in transparent dialogue UI

Post by Thistis »

Hi there,

I'm still a beginner with custom UI designs, so if this might seem a silly question, please bear with me :)
I wanted to make a transparent UI dialogue, but whenever a dialogue closes, I can see for a short moment the text the NPC said before. How can I immediately remove the previous text so that no text is below my current text?

Attached a video of what it looks like:

As you can see, the NPC text (Bruuu bruuuu) is visible for a very short time when the only possible answer was selected by the player, it looks like it overlaps.

These are my current settings for the Dialogue Manager in general:
Image
I thought that perhaps the setting "Show NPC Subtitles with Responses" might solve the problem, but it stays the same.

My custom UI is a copy of the focus template.

All the best,
Evelyn
Last edited by Thistis on Fri Dec 06, 2019 6:01 pm, edited 1 time in total.
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

Re: Hide text after response was selected in transparent dialogue UI

Post by Tony Li »

Hi Evelyn,

This happens because, in your dialogue UI, the subtitle panel and the response menu panel overlap. When the response menu panel fades out, the subtitle panel underneath it is briefly visible.

The solution is to tell the subtitle panel to disappear when the response menu panel is visible. To do this, inspect the subtitle panel's Standard UI Subtitle Panel component. Change the Visibility dropdown to Only During Content.

Alternatively, move the subtitle panel to a separate location, as in the Basic Standard Dialogue UI, or Wheel UI as seen in DemoScene1.
Thistis
Posts: 27
Joined: Sat Oct 05, 2019 5:05 pm

Re: Hide text after response was selected in transparent dialogue UI

Post by Thistis »

Hello Toni,

thanks for your speedy reply.
Do you mean this setting? I clicked on the Subtitle Panel 0 (NPC) in the Dialogue Panel and changed the setting here.
I changed it for the PC as well, but I can still see it for a very short moment unfortunately :/

Image

The second option might be better, but we would like to have the dialogue stay in the same place hmm :/

All the best,
Evelyn
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

Re: Hide text after response was selected in transparent dialogue UI

Post by Tony Li »

I'm having trouble reproducing the issue. Here's my test scene if you want to compare it to yours:

TestHideText_2019-10-31.unitypackage

Alternatively, you could clear the subtitle text whenever the subtitle panel loses focus:

Image

Or clear it whenever the response menu gains focus. (In this case, set the response menu's OnFocus() event to clear the subtitle text.)
Thistis
Posts: 27
Joined: Sat Oct 05, 2019 5:05 pm

Re: Hide text after response was selected in transparent dialogue UI

Post by Thistis »

Hello Tony,

sorry for the late reply, I was ill the last week and didn't get to test it before.
I tried your scene, but here I could also reproduce the error


Around second 8, you can see after choosing the reply "I'm on it" that both texts are overlayed for a short moment, as chosen reply "I'm on it" and the previous text "Help me take out those enemies before they call for reinforcements".
Maybe it's better visible in this screenshot from the video:
Image

I found a way in the meantime that works for us :)
- Set the image of the Text Panel to disabled
- Set the image of Response Menu Panel to disabled
- Create a game object that contains the background and is listed below the other GameObjects
- Set the visibility of Standard UI Subtitle Panel for PC to Visbility - Only During Content
- Set the visibility of Standard UI Subtitle Panel for NPC to Visbility - Only During Content

All the best,
Evelyn
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

Re: Hide text after response was selected in transparent dialogue UI

Post by Tony Li »

Hi Evelyn,

I'm glad you found something that works for you. The issue is that the panels are fading out and in at the same time (which is by design). An alternative would be to turn off the fade animations by setting the panels' Show Trigger and Hide Trigger fields to blank strings. However, this would turn off the fades entirely, which may not be what you want.
Thistis
Posts: 27
Joined: Sat Oct 05, 2019 5:05 pm

Re: Hide text after response was selected in transparent dialogue UI

Post by Thistis »

Hello Toni,

I tried to play a bit around with this one again and I actually liked the idea that you wrote in one answer of this post
Tony Li wrote: Thu Oct 31, 2019 9:51 am ...
Alternatively, you could clear the subtitle text whenever the subtitle panel loses focus:
...
Or clear it whenever the response menu gains focus. (In this case, set the response menu's OnFocus() event to clear the subtitle text.)
On Unfocus() didn't work for me. I tried to disable a GameObject when OnFocus() is triggered, but this doesn't seem to happen with the Focus Template, at least nothing happened when I tried, maybe because the NPC panel is set to "Always Once Shown", else the NPC image would disappear.

I tried your other solution, setting the Subtitle Text to an empy String when the Response Menu Panel gains Focus. This does work, but unfortunately it does take some time until the text disappears, see video below:

I tried to change the "Focus Check Frequency" to a very low value (0.01), but this didn't effect the speed. I guess it might also have to do with the fade animation, as the Response Menu Panel might only gain focus after the Text Panel has completely faded?

Any ideas how I could continue with this?
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

Re: Hide text after response was selected in transparent dialogue UI

Post by Tony Li »

Hi,

Let's try this: Add a Dialogue System Events component to the dialogue UI. Configure the OnConversationResponseMenu() event to clear the subtitle text, like this:

Image

Here's an example scene:

DS_FocusAndPortraits_2019-12-05.unitypackage

I exported it from Unity 2019.2. If it doesn't work and you're using an earlier version of Unity, let me know and I'll recreate it in that version.

In the example scene, the response menu is semi-transparent purple, and the response buttons start lower than the subtitle text so you can clearly see if they're visible at the same time. (They shouldn't be.)
Thistis
Posts: 27
Joined: Sat Oct 05, 2019 5:05 pm

Re: Hide text after response was selected in transparent dialogue UI

Post by Thistis »

Hello Toni,

I just tried the testscene and integrated it into our project and now it works perfectly, thank you very much! ^_^

All the best,
Evelyn
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

Re: SOLVED: Hide text after response was selected in transparent dialogue UI

Post by Tony Li »

Happy to help! :-)
Post Reply