// parent为空时,生成到对应的layer下 public static T AttachUIView <T>( string abPath, UIBaseContainer owner, GameObject parent = null, UILayer attachLayer = UILayer.Common, Vector3 localPosition = new Vector3(), bool isFullScreen = true ) where T : Component { T result = null; if (parent == null) { parent = UITools.GetLayerRoot(attachLayer).gameObject; } if (parent != null) { result = InstanceAssetGameObject <T>(abPath, parent, isFullScreen); if (result != null) { UIBaseView uiView = result as UIBaseView; if (uiView != null) { uiView.SetOwner(owner); } result.name = owner.ControllerId; result.gameObject.transform.localPosition = localPosition; } } return(result); }
public virtual void SetOwner(UIBaseContainer InOwner) { owner = InOwner; }