Calling IEnum_FunctionName()

Using IEnum to run script logic over time.

Use IEnum to run script logic over time without stuffing everything into TickUpdate. Think of it like a lightweight “task” you start once, and the engine keeps ticking it.

Starting an IEnum

Start an IEnum from Begin (or whenever you want it to begin):

void Begin(ScriptContext& ctx, float /*dt*/)
{
    IEnum_Start(IEnum_RotateSelf);
}

Stopping an IEnum

You can stop IEnums by simply calling this:

IEnum_Stop(IEnum_RotateSelf);

You can also toggle Start and Stop by simply calling this:

static IEnumHandle rotateTask;

void Begin(ScriptContext& ctx, float)
{
    rotateTask = IEnum_Start(IEnum_RotateSelf);
}

void End(ScriptContext& ctx)
{
    IEnum_Stop(rotateTask);
}

Toggling IEnum from the Inspector

Running multiple IEnums

You can run multiple IEnums at the same time:

Example IEnum function

This is the “shape” of a simple IEnum:

Notes:

  1. Always null-check ctx.object (objects can be deleted / detached).

  2. Don’t spam logs every frame inside an IEnum (use “warn once” patterns).

Last updated

Was this helpful?