/// <summary> /// 添加界面 /// </summary> /// <param name="frame"></param> public void AddFrame(UIFrame frame) { if (root == null) { return; } if (frame == null) { return; } var rect = frame.GetComponent <RectTransform>(); if (rect != null) { root.AddChild(frame.gameObject); rect.anchorMin = Vector2.zero; rect.anchorMax = Vector2.one; rect.pivot = Vector2.zero; rect.offsetMin = Vector2.zero; rect.offsetMax = Vector2.zero; //rect.sizeDelta = Vector2.zero; } }
/// <summary> /// 移除界面 /// </summary> /// <param name="frame"></param> public void RemoveFrame(UIFrame frame) { if (root == null) { return; } if (frame == null) { return; } root.RemoveChild(frame.gameObject); }