Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
public GameObject text;
void Start()
{
text.SetActive(false);
const float DELAY = 5f;
Invoke("ShowText", DELAY);
}
void ShowText()
{
text.SetActive(true);
}
You set the time of appearance and every frame you check if it has come yet.
I like working with async/await Task.Yield()
the most. The biggest plus of this approach is that all timings and counters and other auxiliary variables remain inside the function.
private static async void SaveByTimeout()
{
var timer = 0f;
var timeout = 5 * 60;
while (IsSaveByTimeout)
{
if (timer >= timeout)
{
timer = 0;
Save();
}
await Task.Yield();
timer += Time.deltaTime;
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question