public static TextListItem AddText(TextListItem prefab, RectTransform contentRoot, string text, int maxEntries, ScrollRect scrollRect) { if (contentRoot == null) { return(null); } var listItem = GameObject.Instantiate <TextListItem>(prefab, contentRoot, false); listItem.SetText(text); GUIHelper.RemoveChildren(contentRoot, maxEntries); if (scrollRect != null && scrollRect.isActiveAndEnabled) { scrollRect.StartCoroutine(ScrollToBottom(scrollRect)); } return(listItem); }