예제 #1
0
    private void SetAnchorsTopRight()
    {
        if (GUILayout.Button("Set Anchors Top Right", buttonContentStyle))
        {
            GameObject[] selectedGameObjects = Selection.gameObjects;

            foreach (var g in selectedGameObjects)
            {
                RectTransform rectTransform = g.GetComponent <RectTransform>();

                if (rectTransform != null)
                {
                    AiryUIAnchors.SetAnchorsTopRight(rectTransform);
                }
            }
        }
    }
    private void SetAnchorsTopRight()
    {
        var btnContent = new GUIContent()
        {
            text = "Set Anchors Top Right", tooltip = "Move Anchors to top right of the rect"
        };

        if (GUILayout.Button(btnContent, GUILayout.Height(50)))
        {
            GameObject[] selectedGameObjects = Selection.gameObjects;

            foreach (var g in selectedGameObjects)
            {
                RectTransform rectTransform = g.GetComponent <RectTransform>();

                if (rectTransform != null)
                {
                    AiryUIAnchors.SetAnchorsTopRight(rectTransform);
                }
            }
        }
    }