/// <summary> /// Place the close button to the right of the content. /// </summary> public void DisplayCloseButtonRight() { //Position Content //SetContentAnchors(new Vector2((contentRect.sizeDelta.x / rectTransform.sizeDelta.x) * 0.5f, 0.5f)); SetContentAnchors(ControlPanelSide.Right); //Position Control Panel to Right of Content controlPanelSide = ControlPanelSide.Right; PositionControlPanel(); }
//To resize content automatically on scale change in discovery editor private void SetContentAnchors(ControlPanelSide side) { contentRect.anchorMin = new Vector2(0, 0); contentRect.anchorMax = new Vector2(1, 1); if (side == ControlPanelSide.Left) { contentRect.offsetMin = new Vector2(100, 0); contentRect.offsetMax = new Vector2(0, 0); } else { contentRect.offsetMin = new Vector2(0, 0); contentRect.offsetMax = new Vector2(-100, 0); } }