void Start()
{
if (botao.activeInHierarchy == true)
{
bool enabled1 = GetComponent().enabled;
}
if (botao.activeInHierarchy == false)
{
bool enabled1 = GetComponent<PlayerMovement>().enabled = false;
}
}
void Start()
{
if (botao.activeInHierarchy == true)
{
bool enabled1 = GetComponent().enabled;
}
if (botao.activeInHierarchy == false)
{
bool enabled1 = GetComponent<PlayerMovement>().enabled = false;
}
}
You should solve the problem in Update(), not in Start() which only run once. Also you don’t achieve anything by setting the local variable enabled1. I’m not sure what you want to do. And what “play-button” do you mean? Maybe this can help.
void Update()
{
GetComponent<PlayerMovement>().enabled = botao.activeInHierarchy;
}