-
Notifications
You must be signed in to change notification settings - Fork 1
API.Service.Coroutine
JuDelCo edited this page May 20, 2021
·
5 revisions
Namespace: Ju.Services
This service handles coroutines and their lifecycle.
Coroutine StartCoroutine(ILinkHandler handle, IEnumerator routine);
Refs: ILinkHandler
This framework provides also some classes to control the flow of your coroutine:
TaskWaitUntil
TaskWaitWhile
TaskWaitForNextUpdate
TaskWaitForNextFixedUpdate
TaskWaitForSeconds<T>
TaskWaitForFrames<T>
private void StartCoroutines()
{
Core.Coroutine.CoroutineStart(new ObjectLinkHandler<IService>(this), CustomCoroutine());
}
private IEnumerator CustomCoroutine()
{
// Yield until the next update tick
yield return null;
// Yield until condition is true
yield return new TaskWaitUntil(condition);
// Yield until condition is false
yield return new TaskWaitWhile(condition);
// Yield until next update
yield return new TaskWaitForNextUpdate();
// Yield until next fixed update
yield return new TaskWaitForNextFixedUpdate();
// Yield for 2 seconds
yield return new TaskWaitForSeconds<TimeUpdateEvent>(2f);
// Yield for 5 frames
yield return new TaskWaitForFrames<TimeUpdateEvent>(5);
// Yield for 12 fixed frames
yield return new TaskWaitForFrames<TimeFixedUpdateEvent>(12);
}
Refs: ILinkHandler
Return to [Home]
- Home
- Install
- Manual
-
Core API
- Services:
- Util:
-
Unity API
- Services:
- Integrations: