X
X
Xoggas2020-08-26 20:57:15
Unity
Xoggas, 2020-08-26 20:57:15

How to create an event that will be tied to time?

I have a question, I need to bind some action by a certain time, well, let's make it so that some method is called. How to do this?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
DanielMcRon, 2020-08-26
@DanielMcRon

Constant cycle - you can coroutine. You need a certain time - checking the conditions.

D
dollar, 2020-08-26
@dollar

In Update(), look at the system time, knowing the moment of reference.
It is desirable to hang up all events (if there are more than one) to check the system time in a single place.

G
GFX Data, 2020-08-29
@ShockWave2048

If the time interval is exactly known, then simply Invoke ();

float timeRange = 2f; // в секундах
Invoke("MyMethod", timeRange);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question