using System.Collections.Generic; using UnityEngine.UI; namespace UnityEngine.XR.ARFoundation { /// /// Script that handles button highlighting in menus when button is selected. /// [RequireComponent(typeof(Image))] [HelpURL(typeof(ToolButton))] public class ToolButton : MonoBehaviour { [SerializeField] [Tooltip("The list of other highlight images for the buttons in the menu.")] List m_buttonHighlights; /// /// The list of other highlight images for the buttons in the menu. /// /// /// A list of other highlight images for the buttons in the menu. /// public List buttonHighlights { get => m_buttonHighlights; set => m_buttonHighlights = value; } void Start() { m_Image = GetComponent(); } /// /// Method that shows or hides the image that highlights the button. /// public void HighlightButton() { if (m_Image.enabled) { m_Image.enabled = false; } else { foreach (var highlightImage in m_buttonHighlights) { highlightImage.enabled = false; } m_Image.enabled = true; } } Image m_Image; } }