using UnityEngine; using UnityEngine.UI; namespace NextMind.Examples.NeuroTagGallery { /// /// Class used to change the description of a step when we click on an object. /// public class DescriptionModifier : MonoBehaviour { [Header("Description text")] /// /// Where to print the new text. /// [SerializeField] private Text descriptionText; /// /// The text to concatenate. /// [TextArea, SerializeField] private string newDescription; [Header("Lines")] /// /// The underline to turn on. /// [SerializeField] private GameObject selectedLine; /// /// The underlines to turn off. /// [SerializeField] private GameObject otherLine1; [SerializeField] private GameObject otherLine2; /// /// The original description text that was displayed. /// private string defaultDescriptionText; private void Awake() { defaultDescriptionText = descriptionText.text; } private void OnMouseDown() { descriptionText.text = defaultDescriptionText + "\n\n" + newDescription; selectedLine.SetActive(true); otherLine1.SetActive(false); otherLine2.SetActive(false); } } }