First text of a conversation node doesn't get displayed.

Announcements, support questions, and discussion for the Dialogue System.
Tabble
Posts: 7
Joined: Thu Oct 26, 2017 10:55 am

Re: First text of a conversation node doesn't get displayed.

Post by Tabble »

Another day, another try :)

The script execution order didn't change anything. But I found the problem. I'm not enterly sure why. Maybe you've got an insight.
It happens in the UnityUITypewriterEffect calss.

Code: Select all

public IEnumerator Play()
{
     if ((control != null) && (charactersPerSecond > 0))
     {
      // Setup:
     InitAutoScroll();
     //yield return waitOneFrameBeforeStarting ? null : new WaitForEndOfFrame();
     if (audioSource != null) audioSource.clip = audioClip;
      ...
     }
    Stop();
}
I commented the line yield return waitOneFrameBeforeStarting ? null : new WaitForEndOfFrame(); because when the running system came to this point it just broke and moved to the code where it calls Stop() at the end of the methode.
It only happens if you switch a scene and the first conversation node with text gets displayed.

I hope that I have written it understandably. I'm still not sure why it breaks, but I'll investigate more.
User avatar
Tony Li
Posts: 22655
Joined: Thu Jul 18, 2013 1:27 pm

Re: First text of a conversation node doesn't get displayed.

Post by Tony Li »

Thanks for the info! I'll reproduce that here and try to provide a fix soon.
User avatar
Tony Li
Posts: 22655
Joined: Thu Jul 18, 2013 1:27 pm

Re: First text of a conversation node doesn't get displayed.

Post by Tony Li »

Just posting an update that a fix will be in 1.7.7, which is being released this week.
Tabble
Posts: 7
Joined: Thu Oct 26, 2017 10:55 am

Re: First text of a conversation node doesn't get displayed.

Post by Tabble »

Thank you :)

Can you tell me the reason why it happened? I haven't had the time to look into it yet.
User avatar
Tony Li
Posts: 22655
Joined: Thu Jul 18, 2013 1:27 pm

Re: First text of a conversation node doesn't get displayed.

Post by Tony Li »

Sure, here's the reason: The typewriter effect is on the subtitle line GameObject. This GameObject is normally disabled. The Dialogue System enables it when showing a subtitle. The typewriter effect starts typing when the GameObject is enabled. When it starts typing, it records the current contents of the UI Text, clears it, and starts typing it character by character.

There can be a race condition where the UI visually refreshes the UI Text component just before the typewriter effect receives the OnEnable method and starts typing. This makes the full contents visible for one frame.

To resolve this race condition, in version 1.7.7 the dialogue UI now explicitly tells the typewriter to start typing immediately after setting the UI Text contents, instead of waiting for OnEnable.
Post Reply