Skip to content
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

Write On Start option not working #27

Open
arvz opened this issue Oct 18, 2024 · 1 comment
Open

Write On Start option not working #27

arvz opened this issue Oct 18, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@arvz
Copy link

arvz commented Oct 18, 2024

Describe the bug
When disabling Write On Start on TMPWriter, the writer still automatically starts writing when on Start()

To Reproduce

  1. Create a gameobject with TextMeshProUGUI component and TMPWriter component
  2. Set some text in the TextMeshProUGUI
  3. Disable Write On Start option on TMPWriter
  4. Start game, observe the writer begins writing

Expected behavior
TMPWriter shouldn't begin Writing automatically

I've put a debug log in the StartWriter() method, and the stack trace is:

StartWriter
TMPWriter.StartWriter() at /External /TMPEffects/Runtime/Components/TMPWriter/TMPWriter.cs:203
TMPWriter.OnTextChanged_Late() at /External /TMPEffects/Runtime/Components/TMPWriter/TMPWriter.cs:605
TMPMediator.TextChangedProcedure() at /External /TMPEffects/Runtime/Components/TMPMediator/TMPMediator.cs:345
TMPMediator.OnTextChanged() at /External /TMPEffects/Runtime/Components/TMPMediator/TMPMediator.cs:297
TMPro.FastAction`1<UnityEngine.Object>.Call() at ./Library/PackageCache/com.unity.textmeshpro@3.0.9/Scripts/Runtime/FastAction.cs:73
TMPro_EventManager.ON_TEXT_CHANGED() at ./Library/PackageCache/com.unity.textmeshpro@3.0.9/Scripts/Runtime/TMPro_EventManager.cs:77
TextMeshProUGUI.GenerateTextMesh() at ./Library/PackageCache/com.unity.textmeshpro@3.0.9/Scripts/Runtime/TMPro_UGUI_Private.cs:4485
TextMeshProUGUI.OnPreRenderCanvas() at ./Library/PackageCache/com.unity.textmeshpro@3.0.9/Scripts/Runtime/TMPro_UGUI_Private.cs:1670
TextMeshProUGUI.ForceMeshUpdate() at ./Library/PackageCache/com.unity.textmeshpro@3.0.9/Scripts/Runtime/TextMeshProUGUI.cs:547
TMPMediator.ForceReprocess() at /External /TMPEffects/Runtime/Components/TMPMediator/TMPMediator.cs:93
TMPWriter.OnEnable() at /External /TMPEffects/Runtime/Components/TMPWriter/TMPWriter.cs:451
@arvz arvz added the bug Something isn't working label Oct 18, 2024
@Luca3317
Copy link
Owner

You also have to disable "WriteOnNewText", since the first text is also considered a new text.
Which is because TextMeshPro invokes the TEXT_CHANGED_EVENT once for every TMP_Text when first enabled.

Let me know if that solved your issue or if something else is going on ✌️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants