We used the following lines in Unity 2022, and it worked perfectly to modify text fonts during runtime. Unfortunately we needed to update to Unity 6 and this code doesn't work anymore. I know its not a great way to place fonts into the fallback list and refresh fonts based on that, but there's no way to rewrite this. Its an already released game made mainly in Unity 2022.
Its also not possible to reassign font types on all of the TextMeshProUGUI components, because there are hundreds of different texts all over the project in many different prefabs and gameobjects.
Is there a way to solve this without rewriting an already published game?
mainFontAsset.fallbackFontAssetTable[0] = fontAsset;
TMP_Text[] allTexts = FindObjectsOfType<TMP_Text>();
foreach (TMP_Text text in allTexts)
{
text.ForceMeshUpdate(true);
}