private Button InstantiateButton(NodeToMenu nodeToMenu) { Button b = Instantiate <Button>(buttonTemplate); VerticalLayoutGroup vGroup = nodeToMenu.menu.GetComponentInChildren <VerticalLayoutGroup>(); b.transform.SetParent(vGroup ? vGroup.transform : nodeToMenu.menu.transform, false); return(b); }
private void CreateButtons(NodeToMenu nodeToMenu, Node node) { foreach (var item in node.outPoint) { Button b = InstantiateButton(nodeToMenu); b.name = item.textName; Text t = b.GetComponentInChildren <Text>(); if (t) { t.text = b.name; } nodeToMenu.buttons.Add(b); } }
private List <NodeToMenu> InstantiateMenus() { List <NodeToMenu> menus = new List <NodeToMenu>(); foreach (var item in nodes) { Menu m = Instantiate <Menu>(menuTemplate); m.name = item.menuName; NodeToMenu nm = new NodeToMenu(m); CreateButtons(nm, item); menus.Add(nm); } return(menus); }