public void GetParent()
    {
        _container = transform.parent.GetComponent <RectTransform>();
        _target    = GetComponent <RectTransform>();

        if (_axis == targetAxis.none)
        {
            _axis = targetAxis.both;
        }

        Debug.Log("<color=yellow> Utility Transform: </color> <color=orange> " + name + " Got Parent </color>");

        _getParent = false;
    }
    public void GetTarget()
    {
        if (_container == null)
        {
            _container = GetComponent <RectTransform>();
        }

        if (_axis == targetAxis.none || _axis == targetAxis.both)
        {
            _axis = targetAxis.vertical;
        }

        AddLayoutGroup();

        _maxValues = _container.sizeDelta;
        _maxWidth  = _container.rect.width;
        _maxHeight = _container.rect.height;
    }
示例#3
0
    public void GetChildren()
    {
        if (_axis == targetAxis.none)
        {
            _axis = targetAxis.vertical;
        }

        if (_container == null)
        {
            _container = GetComponent <RectTransform>();
        }

        int _total = 0;

        for (int i = 0; i < _container.childCount; i++)
        {
            if (_container.GetChild(i).GetComponent <UiUtilityImage>() == false)
            {
                _total++;
            }
        }

        _totalElements = _total;

        if (_targetElements == null)
        {
            _getChildren = true;
        }

        _targetElements = new RectTransform[_totalElements];

        for (int i = 0; i < _totalElements; i++)
        {
            _targetElements[i] = _container.GetChild(i).GetComponent <RectTransform>();
        }
    }