Exemplo n.º 1
0
        protected override void Start()
        {
            base.Start();
            m_Image = GetComponentInChildren<UIImage>();
            m_Label = GetComponentInChildren<UILabel>();

        }
Exemplo n.º 2
0
        /// <summary>
        /// Updates the UILabel and UIImage components
        /// </summary>
        public void UpdateComponents()
        {
            if(m_Image == null)
            {
                m_Image = GetComponentInChildren<UIImage>();
            }
            if(m_Label == null)
            {
                m_Label = GetComponentInChildren<UILabel>();
            }

            SetTexture();
            if(m_AutoAdjust == true && uiToggle != null)
            {
                BoxCollider boxCollider = uiToggle.GetComponent<BoxCollider>();
                if (boxCollider != null)
                {
                    boxCollider.isTrigger = true;
                    label.UpdateBounds(boxCollider, m_MinWidth);
                    if (autoAdjust == true)
                    {
                        image.width = boxCollider.size.x;
                        image.height = boxCollider.size.y;
                        image.GenerateMesh();
                    }
                }
            }

        }