void CreateFileButtons() { try { var files = Directory.GetFiles(FolderPath.GetFolder(), "*.json"); if (files.Length == 0) { CreateErrorMessage(); } else { foreach (string f in files) { string file = f.Remove(0, FolderPath.GetFolder().Length); GameObject newButton = Instantiate(baseButton); newButton.transform.GetChild(0).GetComponent <Text>().text = file; contentsManager.AddToContents(newButton); newButton.GetComponent <Button>().onClick.AddListener(() => { LoadSimulation(file); }); newButton.SetActive(true); } } } catch (DirectoryNotFoundException) { CreateErrorMessage(); } }
void GenerateListEntries() { foreach (var item in listItems) { GameObject newListItem = Instantiate(textBox); newListItem.GetComponent <Text>().text = item; contentsManager.AddToContents(newListItem); newListItem.SetActive(true); } }
void GenerateButtons() { foreach (var target in correlationTargets) { GameObject newButton = Instantiate(baseButton); newButton.transform.GetChild(0).GetComponent <Text>().text = target.nameStr; contentsManager.AddToContents(newButton); newButton.GetComponent <Button>().onClick.AddListener(() => { CloseContactWindow(target); }); newButton.SetActive(true); } }