Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags
(1 edit)

Great find! That makes sense - it made me remember something about TextMeshPro's Rebuild() which is passing in a `UnityEngine.UI.CanvasUpdate` value. From that, I tried calling `Canvas.ForceUpdateCanvases();` just before setting the text (so before triggering a Rebuild()) and it worked. My script looks like this now:

using UnityEngine;
using I2.Loc;
    
[RequireComponent(typeof(SuperTextMesh))]
public class VSScreenTextHelper : MonoBehaviour {
    public string LocalizationString;
    private SuperTextMesh textMesh;
    
    void Start () {
        textMesh = GetComponent<SuperTextMesh>();
        Canvas.ForceUpdateCanvases();
        textMesh.Text = LocalizationManager.GetTermTranslation(LocalizationString);
    }
}

This makes me think that this is happening only because I'm calling it inside the Start/Awake function. As per docs (emphasis mine):

A canvas performs its layout and content generation calculations at the end of a frame, just before rendering, in order to ensure that it's based on all the latest changes that may have happened during that frame. This means that in the Start callback and the first Update callback, the layout and content under the canvas may not be up-to-date.

Code that relies on up-to-date layout or content can call this method to ensure it before executing code that relies on it.

I hope this can lead you to a potential implementable solution inside STM! Cheers!