public static GObject CreateComAddToRoot(string packName, string resName) { GObject go = UIPackage.CreateObject(packName, resName); if (go != null) { GRoot.inst.AddChild(go); go.size = GRoot.inst.size; go.Center(true); } else { Debug.LogError("创建失败:" + "packName=" + packName + "/resName=" + resName); } return(go); }