private static void SetDefaultTextValues(TranslatedUIText lbl) { // Set text values we want across UI elements in default controls. // Don't set values which are the same as the default values for the Text component, // since there's no point in that, and it's good to keep them as consistent as possible. lbl.color = s_TextColor; // Reset() is not called when playing. We still want the default font to be assigned lbl.AssignDefaultFont(); }
public static GameObject CreateText(Resources resources) { GameObject go = CreateUIElementRoot("TranslatedText", s_ThickElementSize); TranslatedUIText lbl = go.AddComponent <TranslatedUIText>(); lbl.text = "New Text"; SetDefaultTextValues(lbl); return(go); }