I am trying to check whether or not a game object is set active using an if statement but whenever I try to unity says that I cant do it because it is a “group method” so I am trying to figure out how to do the same thing but using a different method.
Here is the code i have:
public class Pause_controls : MonoBehaviour
{
bool disabled;
public GameObject panelE;
// Start is called before the first frame update
void Start()
{
disabled = false;
}
// Update is called once per frame
void Update()
{
Controls();
if (disabled == true)
{
keybinds();
}
}
void Controls()
{
if (Input.GetKeyDown(KeyCode.Escape))
{
disabled = true;
}
}
void keybinds()
{
if (Input.GetKeyDown("r"))
{
restart();
}
else if (Input.GetKeyDown(KeyCode.Backspace))
{
exit();
}
else if (Input.GetKeyDown("t"))
{
Sc();
}
else if (Input.GetKeyDown("f"))
{
menu();
}
}
void restart() {...
void exit() {...
void Sc() {...
void menu() {...
}