Skip to content

Fix late line complete callback in line with markup #329

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Abban
Copy link

@Abban Abban commented May 19, 2025

Fixes #328

When showing characters with the typewriter effect the LinePresenter loops the characters in the string and sets maxVisibleCharacters on the Textmesh component. If a line has markup tags those will be looped too. That means when a line contains markup it will exceed the number of characters that needs to be passed to TM causing a delay between the text becoming visible at runtime and the OnLineDisplayComplete() method being called.

This can cause issues if, for example, a connected ActionMarkupHandler needs to decide whether call RequestHurryUpLine() or RequestNextLine() as the line will be visibly finished, but the loop will still be running for the count of extra characters.

This replaces the total count in the loop with the amount of visible characters so it will sync back up.

For some reason lineText.textInfo doesn't contain the correct current count but calling lineText.GetTextInfo() with the current line text does.

Fixes YarnSpinnerTool#328

When showing characters with the typewriter effect the `LinePresenter`
loops the characters in the string and sets maxVisibleCharacters on
the Textmesh component. If a line has markup tags those will be looped
too. That means when a line contains markup it will exceed the number
of characters that needs to be passed to TM causing a delay between
the text becoming visible at runtime and the `OnLineDisplayComplete()`
method being called.

This can cause issues if, for example, a connected `ActionMarkupHandler`
needs to decide whether call `RequestHurryUpLine()` or `RequestNextLine()`
as the line will be visibly finished, but the loop will still be running
for the count of extra characters.

This replaces the total count in the loop with the amount of visible
characters so it will sync back up.

For some reason `lineText.textInfo` doesn't contain the correct current
count but calling `lineText.GetTextInfo()` with the current line text
does.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Line markup causes a delay in triggering OnLineDisplayComplete on an ActionMarkupHandler
1 participant