I’m pretty new to this so excuse my ignorance. I have a button that when selected I want a buttonSelected bool to be true then when I deselect bool is back to false.
Very simple, and every time I select the button the log shows up in my console but not for
deselect. Why is this not working and why am I so dumb. Thank you.
Nevermind I’m dumb thank you.
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
public class Button1 : MonoBehaviour, ISelectHandler
{
public bool buttonSelected = false;
public void OnSelect(BaseEventData eventData)
{
Debug.Log("button 1 selected");
buttonSelected = true;
}
public void OnDeselect(BaseEventData eventData)
{
buttonSelected = false;
Debug.Log("button 1 deselected");
}