Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

Bug Crash in TMP

Discussion in 'UGUI & TextMesh Pro' started by Baste, Oct 13, 2020.

  1. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,340
    I've recently got a few crash reports, and finally I got a stack trace for one of them:

    Code (csharp):
    1.  
    2. ========== OUTPUTTING STACK TRACE ==================
    3.  
    4. 0x00007FFC7C1A07D3 (ntdll) RtlGetCurrentServiceSessionId
    5. 0x00007FFC7C19FB91 (ntdll) RtlFreeHeap
    6. 0x00007FFC16365D68 (UnityPlayer) UnityMain
    7. 0x00007FFC15DB7101 (UnityPlayer) UnityMain
    8. 0x00007FFC15BE6890 (UnityPlayer) UnityMain
    9. 0x00007FFC15BE5F80 (UnityPlayer) UnityMain
    10. 0x00007FFC15BEAC1D (UnityPlayer) UnityMain
    11. 0x0000016196A4272C (Mono JIT Code) (wrapper managed-to-native) UnityEngine.TextCore.LowLevel.FontEngine:TryAddGlyphToTexture_Internal (uint,int,UnityEngine.TextCore.LowLevel.GlyphPackingMode,UnityEngine.TextCore.GlyphRect[],int&,UnityEngine.TextCore.GlyphRect[],int&,UnityEngine.TextCore.LowLevel.GlyphRenderMode,UnityEngine.Texture2D,UnityEngine.TextCore.LowLevel.GlyphMarshallingStruct&)
    12. 0x0000016186E7C393 (Mono JIT Code) TMPro.TMP_Text:GetTextElement (uint,TMPro.TMP_FontAsset,TMPro.FontStyles,TMPro.FontWeight,bool&)
    13. 0x0000016122EC7BC3 (Mono JIT Code) TMPro.TextMeshProUGUI:SetArraySizes (TMPro.TMP_Text/UnicodeChar[])
    14. 0x0000016122EC5D3C (Mono JIT Code) TMPro.TMP_Text:ParseInputText ()
    15. 0x0000016122EC5ABB (Mono JIT Code) TMPro.TextMeshProUGUI:OnPreRenderCanvas ()
    16. 0x0000016122EC58CB (Mono JIT Code) TMPro.TextMeshProUGUI:Rebuild (UnityEngine.UI.CanvasUpdate)
    17. 0x0000016122EC49BC (Mono JIT Code) UnityEngine.UI.CanvasUpdateRegistry:PerformUpdate ()
    18. 0x0000016122EC4562 (Mono JIT Code) (wrapper delegate-invoke) <Module>:invoke_void ()
    19. 0x0000016122EC4391 (Mono JIT Code) UnityEngine.Canvas:SendWillRenderCanvases ()
    20. 0x0000016122EC442D (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void (object,intptr,intptr,intptr)
    21. 0x00007FFC1867B7A0 (mono-2.0-bdwgc) mono_get_runtime_build_info
    22. 0x00007FFC18601882 (mono-2.0-bdwgc) mono_perfcounters_init
    23. 0x00007FFC1860A87F (mono-2.0-bdwgc) mono_runtime_invoke
    24. 0x00007FFC15A936F4 (UnityPlayer) UnityMain
    25. 0x00007FFC15A90F20 (UnityPlayer) UnityMain
    26.   ERROR: SymGetSymFromAddr64, GetLastError: 'Prøv å nå ugyldig adresse.' (Address: 00007FFC154310BF)
    27. 0x00007FFC154310BF (UnityPlayer) (function-name not available)
    28. 0x00007FFC1599A347 (UnityPlayer) UnityMain
    29. 0x00007FFC1599A3E9 (UnityPlayer) UnityMain
    30. 0x00007FFC1599C39F (UnityPlayer) UnityMain
    31.   ERROR: SymGetSymFromAddr64, GetLastError: 'Prøv å nå ugyldig adresse.' (Address: 00007FFC15774965)
    32. 0x00007FFC15774965 (UnityPlayer) (function-name not available)
    33.   ERROR: SymGetSymFromAddr64, GetLastError: 'Prøv å nå ugyldig adresse.' (Address: 00007FFC15772F9A)
    34. 0x00007FFC15772F9A (UnityPlayer) (function-name not available)
    35.   ERROR: SymGetSymFromAddr64, GetLastError: 'Prøv å nå ugyldig adresse.' (Address: 00007FFC15777820)
    36. 0x00007FFC15777820 (UnityPlayer) (function-name not available)
    37. 0x00007FFC1577BA7B (UnityPlayer) UnityMain
    38.   ERROR: SymGetSymFromAddr64, GetLastError: 'Prøv å nå ugyldig adresse.' (Address: 00007FF61F3111FA)
    39. 0x00007FF61F3111FA (Mesmer) (function-name not available)
    40. 0x00007FFC7B3C7BD4 (KERNEL32) BaseThreadInitThunk
    41. 0x00007FFC7C1CCE51 (ntdll) RtlUserThreadStart
    42.  
    43. ========== END OF STACKTRACE ===========
    44.  
    This is on Unity 2018.4.24f1, and TMP 1.5.1.

    One thing to note is that we somewhat recently went from packing our fonts statically to packing them dynamically, in order to be able to support translating to new languages without having to remember to rebake all the fonts.

    I'm not sure if it's related, but it does sound very fishy, especially since it's crashing on thrying to resolve glyphs.

    Any ideas? We're supposed to ship very soon, so I might just have to go back to static fonts and hope really hard that that fixes the issue, but I'd love to get some better info on this.
     
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    Are you creating those font assets at runtime or just using dynamic font assets which are shipped with the project?

    Are you able to reliably reproduce this behavior? Any chance you can submit a bug report for me to look at?
     
  3. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,340
    Dynamic font assets which are shipped with the project.

    And I haven't found a repro case yet, it seems to be something along the lines of "when an arbitrary dialogue starts after playing the game for an hour or so".
     
  4. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    Those are always fun to isolate ;)

    Do you have Multi Atlas Texture enabled on that font asset? Perhaps the atlas texture is full... that should not crash but that might give us a clue.

    So see if enabling Multi Atlas Texture changes the behavior or using a larger atlas texture.

    Make sure you also Reset the font asset before creating the build so that it is empty to begin with.
     
    Baste likes this.
  5. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,340
    We have Multi Atlas Texture enabled. We do not reset the font asset before creating the build, that might be the issue. I'll add that to our build scripts.

    It's a bit annoying that the texture is saved to file whenever it auto-expands, as that causes a bunch of version control noise. Any chance that those textures could be made to not save in some fashion?
     
  6. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    In the next release, an option to automatically "Clear Dynamic Data on Build" has been added per font asset.

    With regards to Dynamic Font Asset changes, they are persistent in the Editor but not in builds. Changing this behavior is problematic given many users run full dynamic through most of the development cycle to populate these font assets, allowing them to get a better sense of glyph coverage and overall settings before switching some of these font asset to static before shipping.

    Additional feedback on how to handle these different use cases will be needed.
     
  7. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,340
    How do I reset the font assets from editor code? Can't find a method that seems to do it as I was trying to add it to our build pipeline. For now I'm just manually reseting them, but I'm not going to remember that.

    The point about figuring out glyph coverage is interesting. I can't see a situation where we need to figure out glyph coverage without just iterating all the text in our project, but if text is getting pulled from sources where that's not easy, maybe it's an issue?

    For us, assets other than the one we intended to change changing causes a lot of problems - people get (more) confused about version control, and we get conflicts on things that nobody intended to do any work on. Being able to have the dynamic font assets not be persistent in the editor would be an improvement for us, but I know that Unity in general is very, very afraid of toggles.
     
  8. rhys_vdw

    rhys_vdw

    Joined:
    Mar 9, 2012
    Posts:
    111
    Hi @Stephan_B I would like to report the same issue, but on version 2.1.4, which is newer than the last post to this thread. I've attached logs here. I'm going to try to update to 2.1.6, but I have no idea how to reproduce the issue at this stage so I won't be able to confirm the fix any time soon.

    The only change I can think of is that I recently regenerated all the font atlases using the "ASCII" preset. However they are still on dynamic (as they have been for a year). I was actually in the process of moving to static generation to prevent the version control thrashing issue that Baste reported above. From my understanding there is some fundamental problem where font data is stored in Assets/ instead of Library/ as is standard for importer generated content?

    Anyway, I've written a script that captures all the characters used in our entire game and turns them into a hex range string as accepted by the font builder, but am hitting this same problem that @Baste is hitting above. I have no idea how to automate the font atlas generation as part of our build process. Did you ever find out how to do this procedurally @Baste?
     

    Attached Files:

  9. rhys_vdw

    rhys_vdw

    Joined:
    Mar 9, 2012
    Posts:
    111
  10. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
  11. rhys_vdw

    rhys_vdw

    Joined:
    Mar 9, 2012
    Posts:
    111
    It was intermittent and we haven't seen it since upgrading to latest.