Search Unity

TextMesh Pro Serious TMPro Bug Repro'd Every Time (TMPro Sprites)

Discussion in 'UGUI & TextMesh Pro' started by MrLucid72, May 17, 2019.

  1. MrLucid72

    MrLucid72

    Joined:
    Jan 12, 2016
    Posts:
    995
    This is driving me crazy:



    If you copy+paste TMPro txt "A" to "B" (values), multiple bugs happen:
    1. "B" <sprite> will not show, even though it has the identical tag as the previous one (since copy+paste).
      (This is reverted when I simply save >> leave the scene >> reenter the scene.)

    2. If I attempt to change the <sprite> of "B", not only will it not show up at "B", but "A" CHANGES.
      (This is reverted when I simply save >> leave the scene >> reenter the scene.)

    3. If I change the Text of "B" to something different, completely, the <sprite> of "A" shifts around, yet doesn't affect the other Text of "A" (just the <sprite>).
      (This is reverted when I simply save >> leave the scene >> reenter the scene.)
    This is repro'd every time in my project in the editor and incredibly frustrating.

    (Note that in the video, I'm using a <style> wrapper that includes an `<indent=5.5em></indent>` tag within it, but it all does the same)
     
  2. MrLucid72

    MrLucid72

    Joined:
    Jan 12, 2016
    Posts:
    995
    Noticing these clearable errors:

    Code (CSharp):
    1. Mesh.vertices is too small. The supplied vertex array has less vertices than are referenced by the triangles array. (at ?)
    2. UnityEngine.Mesh:set_vertices(Vector3[]) (at ?)
    3. TMPro.TextMeshProUGUI:GenerateTextMesh() (at Library/PackageCache/com.unity.textmeshpro@1.3.0/Scripts/Runtime/TMPro_UGUI_Private.cs:4072)
    4. TMPro.TextMeshProUGUI:OnPreRenderCanvas() (at Library/PackageCache/com.unity.textmeshpro@1.3.0/Scripts/Runtime/TMPro_UGUI_Private.cs:1642)
    5. TMPro.TextMeshProUGUI:Rebuild(CanvasUpdate) (at Library/PackageCache/com.unity.textmeshpro@1.3.0/Scripts/Runtime/TextMeshProUGUI.cs:209) (at ?)
    6. UnityEngine.Canvas:SendWillRenderCanvases() (at ?)
    Code (CSharp):
    1. Mesh.uv is out of bounds. The supplied array needs to be the same size as the Mesh.vertices array. (at ?)
    2. UnityEngine.Mesh:set_uv(Vector2[])
    3. TMPro.TextMeshProUGUI:GenerateTextMesh()
    4. TMPro.TextMeshProUGUI:OnPreRenderCanvas()
    5. TMPro.TextMeshProUGUI:Rebuild(CanvasUpdate) (at ?)
    6. UnityEngine.Canvas:SendWillRenderCanvases()
    Code (CSharp):
    1. Mesh.uv is out of bounds. The supplied array needs to be the same size as the Mesh.vertices array. (at ?)
    2. UnityEngine.Mesh:set_uv(Vector2[])
    3. TMPro.TextMeshProUGUI:GenerateTextMesh()
    4. TMPro.TextMeshProUGUI:OnPreRenderCanvas()
    5. TMPro.TextMeshProUGUI:Rebuild(CanvasUpdate) (at ?)
    6. UnityEngine.Canvas:SendWillRenderCanvases()
    Code (CSharp):
    1. Mesh.colors is out of bounds. The supplied array needs to be the same size as the Mesh.vertices array. (at ?)
    2. UnityEngine.Mesh:set_colors32(Color32[])
    3. TMPro.TextMeshProUGUI:GenerateTextMesh()
    4. TMPro.TextMeshProUGUI:OnPreRenderCanvas()
    5. TMPro.TextMeshProUGUI:Rebuild(CanvasUpdate) (at ?)
    6. UnityEngine.Canvas:SendWillRenderCanvases()
     
  3. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Thanks for the report.

    I am able to reproduce this behavior and looking into it.
     
  4. MrLucid72

    MrLucid72

    Joined:
    Jan 12, 2016
    Posts:
    995
    Great you got it, @Stephan_B -- while you're there, try a few different combos. 2 out of 5 of those textbox's actually will NOT revert back, doing the opposite:
    • If I reload the scene/prefab, it'll revert back to whatever it started with.
    • If I change 1 character, it goes back to what is expected, BUT poofs again when you save + reload the prefab/scene.
    • No matter what I've tried, I can't get this to perpetually stay changed to what I want to be -- it keeps reverting back to the same text. I'm going to have to delete it and remake it.
    Repro'd each time for me here: http://recordit.co/8OOsTXfbK2 (When it reverts back, you may not see me, but I did CTRL+S, followed by reloading that scene. This demo is in Unicode, but the same happens with English. Notice as soon as I type "test test", it poofs back to the expected text, only to revert again when the scene is saved and reloaded)

    I don't know how this bug was created differently from the one above, but it was a very similar situation: I'm trying to make sure these are all very similarly-formatted, so it involves copy+pasting TMPro txt's into another.

    EDIT: Yep, avoiding copy+pasting in the tmpro txt component values is the temporary workaround. What seems to work (better than nothing) is to clone a txt and move that in the correct position, then change whatever manually from there. Significantly more tedious, but works for now.
     
    Last edited: May 18, 2019
  5. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Already working on a solution which will be included in the next package release of TMP. In the meantime, indeed avoid using Copy Component / Paste Component Values with Sub Mesh objects ;)