Skip to content

Coroutines class ​

Namespace Lustral · Assembly Lustral.Api

A mod's coroutines: methods that run across multiple frames on the game's main thread, with identical behavior on Mono and IL2CPP. A coroutine is an iterator method; each yield return specifies when it resumes:

An exception stops the coroutine and is logged under the mod's ID.

csharp
public sealed class Coroutines

Properties ​

Count ​

csharp
public int Count { get; }

The number of this mod's running coroutines.

Methods ​

Start(IEnumerator) ​

csharp
public CoroutineHandle Start(IEnumerator routine);

Starts a coroutine. When called on the main thread, the coroutine immediately runs until its first yield, as with Unity's StartCoroutine. When called from another thread, its first step runs on the main thread in the next frame.

Stop(CoroutineHandle) ​

csharp
public void Stop(CoroutineHandle coroutine);

Stops a coroutine before its next step. Has no effect if the coroutine has already ended.

StopAll() ​

csharp
public void StopAll();

Stops all coroutines started by this mod.

Mods are third-party software. Lustral does not verify their behavior and is not responsible for any damage they cause.