public void Register(LocText locText) { if (!m_localizedTexts.ContainsKey(locText)) { m_localizedTexts.Add(locText, locText.OnLanguageUpdated); } }
public void Unregister(LocText locText) { if (m_localizedTexts.ContainsKey(locText)) { m_localizedTexts.Remove(locText); } }
public static void ReplaceText() { GameObject go = Selection.activeGameObject; if (go == null) { return; } LocText t = go.GetComponent <LocText>(); if (t == null) { return; } LocText copy = GetCopyOf(t, t); Debug.Log(copy.font.name); UnityEngine.Object.DestroyImmediate(go.GetComponent <LocText>()); Text newText = go.AddComponent <Text>(); // font newText.font = copy.font; newText.fontSize = copy.fontSize; // alignment newText.alignment = copy.alignment; // overflow newText.horizontalOverflow = copy.horizontalOverflow; newText.verticalOverflow = copy.verticalOverflow; // best fit newText.resizeTextForBestFit = copy.resizeTextForBestFit; newText.resizeTextMinSize = copy.resizeTextMinSize; newText.resizeTextMaxSize = copy.resizeTextMaxSize; // color newText.color = copy.color; //text newText.text = copy.text; Debug.Log($"Localization : Localized text { go.name } replaced by default text"); }