protected override void Start() { base.Start(); m_Image = GetComponentInChildren<UIImage>(); m_Label = GetComponentInChildren<UILabel>(); }
/// <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(); } } } }