Search Issue Tracker

Won't Fix

Fix In Review for 6000.3.X

Votes

12

Found in

6000.0.55f1

6000.2.0f1

6000.3.0a4

Issue ID

UUM-113958

Regression

No

TMP_FontAsset fails to change when the Fallback Font Asset is changed

-

Reproduction steps:
1. Open the attached project "ReproProj"
2. Open the “/Assets/Scenes/SampleScene.unity” Scene
3. Enter the Play Mode
4. Press the Button with the text "Switch to Japanese"
5. Observe the character

Expected result: Character changes to Japanese and has the vertical line on top
Actual result: Character stays the same

Reproducible with: 6000.0.55f1, 6000.1.14f1, 6000.2.0f1, 6000.3.0a4
Could not test with: TMP 3.0.6 (2023.1.0a1) (NullReferenceException: Object reference not set to an instance of an object)

Reproducible on:
Play Mode
Windows Standalone Player

Testing environment: Windows 10 Enterprise 21H2
Not reproducible on: No other environment tested

Note:
- Reproducible even when forcing a mesh update on text mesh

  1. Resolution Note:

    Changing a FontAsset’s fallback order at runtime has no effect, as the cache still references the old fallbacks. The following API TMP_ResourceManager.ClearFontAssetGlyphCache() clears the caching.

    private void SetFont(TMP_FontAsset font)
    {
    mainFont.fallbackFontAssetTable.Clear();
    TMP_ResourceManager.ClearFontAssetGlyphCache()

    mainFont.fallbackFontAssetTable.Add(font);

    textMesh.ForceMeshUpdate();
    }

  2. Resolution Note (fix version 6000.3):

    Currently, changing a FontAsset’s fallback order at runtime has no effect, as the cache still references the old fallbacks.

    This PR exposes ClearFallbackCharacterTable, allowing users to manually reset a font’s fallback cache. For example:
    private void SetFont(TMP_FontAsset font)
    {
    mainFont.fallbackFontAssetTable.Clear();
    mainFont.ClearFallbackCharacterTable();

    mainFont.fallbackFontAssetTable.Add(font);

    textMesh.ForceMeshUpdate();
    }

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.