Cysharp/UniTask · error · InvalidOperationException

Target playerLoopTiming is not injected. Please check Player

Error message

Target playerLoopTiming is not injected. Please check PlayerLoopHelper.Initialize. PlayerLoopTiming:

What it means

Thrown by PlayerLoopHelper.AddAction or AddContinuation when the runner (or yielder) for a given PlayerLoopTiming is null — meaning that timing was not injected during Initialize. UniTask routes await continuations and delay tasks through player-loop runners indexed by timing; if the runner was never created, the action cannot be queued.

Source

Thrown at src/UniTask/Assets/Plugins/UniTask/Runtime/PlayerLoopHelper.cs:504

            copyList[i].subSystemList = InsertUniTaskSynchronizationContext(copyList[i]);

            playerLoop.subSystemList = copyList;
            PlayerLoop.SetPlayerLoop(playerLoop);
        }

        public static void AddAction(PlayerLoopTiming timing, IPlayerLoopItem action)
        {
            var runner = runners[(int)timing];
            if (runner == null)
            {
                ThrowInvalidLoopTiming(timing);
            }
            runner.AddAction(action);
        }

        static void ThrowInvalidLoopTiming(PlayerLoopTiming playerLoopTiming)
        {
            throw new InvalidOperationException("Target playerLoopTiming is not injected. Please check PlayerLoopHelper.Initialize. PlayerLoopTiming:" + playerLoopTiming);
        }

        public static void AddContinuation(PlayerLoopTiming timing, Action continuation)
        {
            var q = yielders[(int)timing];
            if (q == null)
            {
                ThrowInvalidLoopTiming(timing);
            }
            q.Enqueue(continuation);
        }

        // Diagnostics helper

#if UNITY_2019_3_OR_NEWER

        public static void DumpCurrentPlayerLoop()
        {

View on GitHub (pinned to ceac8d6946)

Solutions

  1. Call PlayerLoopHelper.Initialize() with InjectPlayerLoopTimings.All (the default) to inject all timing runners.
  2. If using a custom InjectPlayerLoopTimings mask, ensure it includes every PlayerLoopTiming value your code uses.
  3. Verify Initialize was actually called — check for script execution order issues or disabled RuntimeInitializeOnLoadMethod.
  4. If another plugin reinitializes the player loop, re-call PlayerLoopHelper.Initialize() afterward.

Example fix

// before (restricted mask misses FixedUpdate)
PlayerLoopHelper.Initialize(InjectPlayerLoopTimings.Minimum); // only Update
await UniTask.DelayFrame(1, timing: PlayerLoopTiming.FixedUpdate); // throws

// after
PlayerLoopHelper.Initialize(); // default: InjectPlayerLoopTimings.All
await UniTask.DelayFrame(1, timing: PlayerLoopTiming.FixedUpdate); // ok
Defensive patterns

Strategy: validation

Validate before calling

// Ensure all timings are injected
PlayerLoopHelper.Initialize(); // default uses InjectPlayerLoopTimings.All
// If using a custom mask, include every timing you will use:
// PlayerLoopHelper.Initialize(
//     InjectPlayerLoopTimings.Update | InjectPlayerLoopTimings.FixedUpdate |
//     InjectPlayerLoopTimings.LateUpdate /* ... */);

Try / catch

try
{
    await UniTask.Delay(TimeSpan.FromSeconds(1), timing: PlayerLoopTiming.FixedUpdate);
}
catch (InvalidOperationException ex) when (ex.Message.Contains("not injected"))
{
    // Re-initialize with all timings
    PlayerLoopHelper.Initialize();
    await UniTask.Delay(TimeSpan.FromSeconds(1), timing: PlayerLoopTiming.FixedUpdate);
}

Prevention

When it happens

Trigger: Using await UniTask.Delay(..., timing: PlayerLoopTiming.FixedUpdate) or similar when PlayerLoopHelper was initialized with an InjectPlayerLoopTimings mask that excluded FixedUpdate. Or PlayerLoopHelper.Initialize was never called (though the default RuntimeInitializeOnLoadMethod usually covers this).

Common situations: A custom Initialize call that passes a restricted InjectPlayerLoopTimings value (e.g., only Update) but code later uses LateUpdate or FixedUpdate timing. Another plugin re-initialized the player loop after UniTask, clearing its injected runners. Disabling the default RuntimeInitializeOnLoadMethod initialization.

Related errors


AI-assisted analysis of Cysharp/UniTask@ceac8d6946 (2026-08-13). Data as JSON: /api/errors/a7507fbdd40cae1b. Report an issue: GitHub.