D
D
D1mple2022-02-03 21:30:38
User interface
D1mple, 2022-02-03 21:30:38

Timer problem. When you click on the button in the UI, the timer when it becomes > 15 should turn off the object. What to do?

public GameObject RELOAD;
public float timer = 0f;
public float cooldown = 15f;

public void Start()
{

}

public void Update()
{
timer += Time.deltaTime;

}
public void OFF()
{
RELOAD.SetActive(true);
timer=0f;

if(timer > cooldown)
{
RELOAD.SetActive(false);
}
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
freeExec, 2022-02-03
@freeExec

timer = 0f;
if(timer > cooldown)

What is the check timer?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question