// MonoBehaviour's interface protected override void Awake() { base.Awake(); // Clear elements. if (m_NavbarElements != null) { for (int elementIndex = 0; elementIndex < m_NavbarElements.Length; ++elementIndex) { UINavbarElement element = m_NavbarElements[elementIndex]; if (element == null) { continue; } element.isVisible = false; if (m_ElementsAnimatorController != null) { Animator elementAnimator = element.GetComponent <Animator>(); if (elementAnimator == null) { elementAnimator = element.gameObject.AddComponent <Animator>(); } elementAnimator.runtimeAnimatorController = m_ElementsAnimatorController; } } } }
public void SetElement(int i_Index, UINavbarCommand i_Command) { if (m_NavbarElements == null) { return; } if (i_Index < 0 || i_Index >= m_NavbarElements.Length) { return; } UINavbarElement element = m_NavbarElements[i_Index]; if (element == null) { return; } element.Clear(); element.isVisible = false; if (i_Command == null) { return; } element.isVisible = true; Sprite sprite = Internal_GetSprite(i_Command.iconKey); element.SetIcon(sprite); element.SetText(i_Command.text); element.isActive = i_Command.isActive; }