public static void Make(GameUIComponent com, string id, GameObject root, UILogicBase logic, GameUIComponent parent) { if (parent != null) { parent.children.Add(com); } if (logic != null) { com.LogicHandler = logic; logic.AddComponent(com); } com.Init(id, root); }
public static T Make <T>(string id, GameObject root, UILogicBase logic, GameUIComponent parent = null) where T : GameUIComponent, new() { T com = new T(); if (parent != null) { parent.Children.Add(com); } if (logic != null) { com.LogicHandler = logic; logic.AddComponent(com); } com.Init(id, root); if (com.gameObject == null) { return(null); } return(com); }