コード例 #1
0
    void Start()
    {
        if (instance != null)
        {
            Destroy(this);
        }
        else
        {
            instance = this;
        }

        placablesLayout = placables.GetComponent <LayoutElement> ();
        utilityLayout   = utility.GetComponent <LayoutElement> ();
        placablesRect   = placables.GetComponent <RectTransform> ();
        utilityRect     = utility.GetComponent <RectTransform> ();

        if (utilityRect.sizeDelta.x > placablesRect.sizeDelta.x)
        {
            minWidth = placablesRect.sizeDelta.x;
            maxWidth = utilityRect.sizeDelta.x;

            minHeightPref = placablesLayout.preferredHeight;
            maxHeightPref = utilityLayout.preferredHeight;
        }
        else
        {
            minWidth = utilityRect.sizeDelta.x;
            maxWidth = placablesRect.sizeDelta.x;

            minHeightPref = utilityLayout.preferredHeight;
            maxHeightPref = placablesLayout.preferredHeight;
        }

        UpdateGraphics();
    }