So I'm trying to change the function of a button by a clickable method in Unity. I'm using a GetComponent to access the button component of the game object and then assign the clickable function.
But I get this error:
GetComponent requires that the requested component 'Button' derives from MonoBehaviour or Component or is an interface
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.UIElements;
using Button = UnityEngine.UIElements.Button;
public class Button_System : MonoBehaviour
{
public GameObject Button01;
public GameObject Image01;
public void Start()
{
Button01.GetComponent<Button>().clickable = new Clickable(Example);
}
public void Example()
{
Image01.SetActive(false);
}