Hey,
I’m playing with the simple String table. I’m switching from English to Chinese. It works fine with the built in Unity text but TMP needs to switch out to the Chinese Font Asset I made. How do I do this?
Hi,
At the moment you would need to do this with a script. You could create a localized font in the same way we do localized textures etc.
This script will give you a localized font component which works the same way as strings but for font assets
using UnityEngine;
using TMPro;
using UnityEngine.Events;
using UnityEngine.Localization;
using UnityEngine.Localization.Components;
[System.Serializable]
public class LocalizedFont : LocalizedAsset<TMP_FontAsset> {}
[System.Serializable]
public class UpdateFontEvent : UnityEvent<TMP_FontAsset>{}
public class LocalizedFontEvent : LocalizedAssetEvent<TMP_FontAsset, LocalizedFont, UpdateFontEvent>
{
}
Add it to your text and use the event to update the font
We are working on a system to allow for property variants in the next version which will make this much simpler.
1 Like
Thanks, it worked.
1 Like
Hi, I using 2022.3.9. Isn’t there a much simpler solution in this version?