static AsbUI CreateAsbUI(Vector2 Ofs, string FileName, CanvasMgr.eDispSort DispZ, GameObject Parent) { GameObject Obj = new GameObject("AsbUI_" + FileName); if (Parent != null) { Obj.transform.SetParent(Parent.transform, false); } else { CanvasMgr.Instance.EntryDispObj(Obj, DispZ); } RectTransform rt = Obj.GetComponent <RectTransform>(); if (rt == null) { rt = Obj.AddComponent <RectTransform>(); } RectTransform prt = rt.parent.gameObject.GetComponent <RectTransform>(); /*rt.anchorMax = prt.anchorMax; * rt.anchorMin = prt.anchorMin; * rt.pivot = prt.pivot;*/ rt.sizeDelta = prt.sizeDelta; rt.localPosition = Vector3.zero; rt.localScale = Vector3.one; rt.localEulerAngles = Vector3.zero; AsbUI asbUI = Obj.AddComponent <AsbUI>(); asbUI.Init(Ofs, FileName); return(asbUI); }
public static AsbUI CreateAsbUI(Vector2 Ofs, string FileName, CanvasMgr.eDispSort DispZ) { return(CreateAsbUI(Ofs, FileName, DispZ, null)); }