How to change if you can click a button?
I'm making an unlock system but I want to access the Selectable component. The problem is how I can access this component.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class LevelSelectorManager : MonoBehaviour {
public float levelsRequired = 0f;
private float levelsCompleted = 0f;
void Update()
{
if(levelsCompleted <= levelsRequired)
{
}
}
}
I do not understand. Your question is
How to change if you can click a button?
Which means to me how do you enable/disable a button but then you say
but I want to access the Selectable component
I am thinking that you may be looking to do something else. Also the sample script that you provided has no references to a button or a selectable component. So if you could please tell me which and maybe elaborate more on exactly what you are looking to do?
Do you have a preferable method/way that you want to enable/disable a button? I ask because there are numerous ways to do this. Also, do you want to do this from the LevelSelector$$anonymous$$anager
class and when?