Search Issue Tracker

Fixed

Fixed in 4.0.0-pre.2

Votes

0

Found in [Package]

3.2.0-pre.4

Issue ID

TMPB-227

Regression

No

IndexOutOfRangeException is thrown when the project is built and Multi-Atlas Dynamic Fallback Fonts is used

Package: TextMeshPro

-

How to reproduce:
1. Open the attached “TMP Breaks On Build.zip” Project
2. Open the Build Settings (File → Build Settings)
3. Set the Target Platform to Android
4. Build and Run
5. Observe the Console

Expected result: The Build is succesful and the Player runs
Actual result: The Build is succesful but the Player doesn’t run and a “IndexOutOfRangeException” error is thrown in the Console.

Reproducible with: 3.2.0-pre.1, 3.2.0-pre.7 (2021.3.34f1, 2022.3.19f1)
Not reproducible with: 2023.2.8f1, 2023.3.0b5
Couldn’t test with: 3.0.7 (2021.3.34f1, 2022.3.19f1) - “UnassignedReferenceException” is thrown redundantly, 4.0.0-pre.1 (2022.3.19f1) - Un-fixable compilation errors
Fixed in: 4.0.0-pre.2 (2022.3.19f1)

Reproduced on: Windows 11, Windows 10 (Users)
Not reproduced on: No other environment tested

Notes:
- Full error message:

{{IndexOutOfRangeException: Index was outside the bounds of the array.}}
{{TMPro.TMP_MaterialManager.GetFallbackMaterial (TMPro.TMP_FontAsset fontAsset, UnityEngine.Material sourceMaterial, System.Int32 atlasIndex) (at ./Library/PackageCache/com.unity.textmeshpro@3.2.0-pre.7/Scripts/Runtime/TMP_MaterialManager.cs:346)}}
{{TMPro.TextMeshProUGUI.SetArraySizes (TMPro.TMP_Text+TextProcessingElement[] textProcessingArray) (at ./Library/PackageCache/com.unity.textmeshpro@3.2.0-pre.7/Scripts/Runtime/TextMeshProUGUI.cs:2095)}}
{{TMPro.TMP_Text.ParseInputText () (at ./Library/PackageCache/com.unity.textmeshpro@3.2.0-pre.7/Scripts/Runtime/TMP_Text.cs:2007)}}
{{TMPro.TextMeshProUGUI.OnPreRenderCanvas () (at ./Library/PackageCache/com.unity.textmeshpro@3.2.0-pre.7/Scripts/Runtime/TextMeshProUGUI.cs:2408)}}
{{TMPro.TextMeshProUGUI.Rebuild (UnityEngine.UI.CanvasUpdate update) (at ./Library/PackageCache/com.unity.textmeshpro@3.2.0-pre.7/Scripts/Runtime/TextMeshProUGUI.cs:223)}}
{{UnityEngine.UI.CanvasUpdateRegistry.PerformUpdate () (at ./Library/PackageCache/com.unity.ugui@1.0.0/Runtime/UI/Core/CanvasUpdateRegistry.cs:215)}}
{{UnityEngine.Canvas:SendWillRenderCanvases()}}

- Additional information from the user:

# Have a static TMP_FontAsset that does not contain all the needed characters
# Set a fallback on that TMP_FontAsset to a dynamic TMP_FontAsset which has the "Multi Atlas Textures" and "Clear Dynamic Data On Build" features enabled
# Create a TextMeshProUGUI component in the active scene that uses the static TMP_FontAsset but ends up needing to use glyphs from the fallback font, specifically glyphs from the 2nd atlas or later.
# Switch platform to Android (possibly other platforms as well, but I can't confirm at the moment)
# Select Build and Run from the File menu.
# Notice that after the build has succeeded, the TextMeshProUGUI component in the scene has disappeared, and the following error has been printed to the console.

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.