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

Sprites reappear if followed by text with an Animation #38

Closed
edwardrowe opened this issue Jul 20, 2020 · 0 comments
Closed

Sprites reappear if followed by text with an Animation #38

edwardrowe opened this issue Jul 20, 2020 · 0 comments
Labels

Comments

@edwardrowe
Copy link

Repro:
The following is observable in master right now by running the test scene and skipping + advancing.

  1. Print text to a TMProUGui component that includes sprites. Ex: "This is a sprite !"
  2. Change the text to something else.
  3. Call UpdateGeometry on each MeshInfo. Ex:
        var textInfo = this.TextComponent.textInfo;
        for (int i = 0; i < textInfo.meshInfo.Length; i++)
        {
            textInfo.meshInfo[i].mesh.vertices = textInfo.meshInfo[i].vertices;
            this.TextComponent.UpdateGeometry(textInfo.meshInfo[i].mesh, i);
        }

The issue is sort of with TMPro. As an optimization they leave the SubMesh objects around that are used to render the sprites. They use the same SubMesh objects for fallback fonts. Then, in TextAnimation, calling TextComponent.UpdateGeometry(this.textInfo.meshInfo[i].mesh, i); causes the garbage sprite mesh info to be resupplied to the SubMesh.

We should be able to use TextInfo.ClearMeshInfo() before every print to fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant