//Helper function to create new tab component Tab CreateNewTab(string name = "New Tab") { Tab newtab = Instantiate(TabPrefab).GetComponent <Tab>(); newtab.transform.SetParent(TabContainerGO.transform, false); newtab.SetText(name); newtab.gameObject.name = name; newtab.ObjectName = name; newtab.AddButtonOnClickEvent(); return(newtab); }