public UIEx Create(Scene scene, string type, GameObject parent) { try { ResourcesComponent resourcesComponent = ETModel.Game.Scene.GetComponent <ResourcesComponent>(); resourcesComponent.LoadBundle(type.StringToAB()); GameObject bundleGameObject = (GameObject)resourcesComponent.GetAsset(type.StringToAB(), type); GameObject gameObject = UnityEngine.Object.Instantiate(bundleGameObject); gameObject.layer = LayerMask.NameToLayer(LayerNames.UI); UIEx ui = ComponentFactory.Create <UIEx, GameObject>(gameObject); ui.AddUiComponent <TestComponent>(); return(ui); } catch (Exception e) { Log.Error(e); throw; } }
public void Add(UIEx ui) { this.children.Add(ui.Name, ui); ui.Parent = this; }