public static TableRowText Instantiate(GameObject original, Transform parent, string text, bool isHeader = false) { GameObject go = GameObject.Instantiate(original, parent); TableRowText instance = go.GetComponent <TableRowText>(); instance.text.text = text; instance.text.fontStyle = isHeader ? FontStyle.Bold : FontStyle.Normal; return(instance); }
void InstantiateTexts(List <string> data, bool isHeader = false) { foreach (string text in data) { TableRowText.Instantiate(textTemplate.gameObject, transform, text, isHeader); } // Delete template Destroy(textTemplate.gameObject); }
void Awake() { textTemplate = GetComponentInChildren <TableRowText>(); }