Answer the question
In order to leave comments, you need to log in
How to make an event every second (Unity)?
How to make an event every second, please help!
Answer the question
In order to leave comments, you need to log in
Use coroutines andWaitForSecondsRealtime
public class FooComponent : MonoBehaviour
{
private void Awake()
{
StartCoroutine(YieldOneSecond());
}
IEnumerator YieldOneSecond()
{
while (Application.isPlaying)
{
yield return new WaitForSecondsRealtime(1f);
}
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question