Skip to content

Runtime Actor Loader

The Runtime Actor Loader brings actors into the game at the moment your scene wakes. This page says what it does, when a scene needs one, and what the Inspector shows. You add it from Add Component > Intrigues > Runtime Actor Loader.

Per its Inspector, it does two jobs, and both are about getting the right actors into the game at the right moment, before your own scripts start to look for them:

  • When a saved game loads, it brings back the actors your game made while it ran (children, newcomers).
  • When the Intrigue Manager’s Actors without a scene object is on, it also creates, at the start of a new game, the actors of the Actors page that have no object in the scene.

It runs after the manager and the actor objects have woken and before the scene’s ordinary scripts wake. In the code this is execution order -350, after the scene’s actors at -360.

You need one in the scene that holds your game when your own scripts read these actors in Awake. Without a loader, the manager makes the actors itself once the scene has woken. That only happens if the manager’s setting is on and the scene holds an actor object, and those actors appear after every Awake. The Intrigue Manager’s Inspector says the same under Actors without a scene object: “created actors appear after every Awake. Add one if your own scripts read them in Awake.”

You can skip it. That holds when no script of yours reads such actors in Awake, and your game scene holds actor objects.

A scene that holds no actor object at all needs a loader (or a call to IM.CreateMissingActors()) to get the actors of the Actors page. The manager’s Inspector offers a button for it. When the manager’s Game Scenes list is not empty, a loader in a scene that is not on it and holds no actor object brings no actors and logs a warning. Add the scene to Game Scenes.

Put one in the scene that holds your game. Not in a menu scene, and not on the Intrigue Manager’s object. The manager’s object stays when a scene is replaced, so it is not a scene of the game. A loader there brings no actors and logs a warning; the Inspector warns about it too.

Part What it says
Section Runtime Actor Loader The two jobs above, and the hint about where to put it.
Warning in the section The loader sits on the Intrigue Manager’s object, or its class declares its own Awake. A subclass Awake hides the loader’s, so it never runs. Remove that Awake.
A section named after your class Only when you derive from the loader and add serialized fields. It lists them.
Edit mode, more than one loader A warning that the open scenes hold N loaders. One is enough.
Play mode The line “Actors created at run time: N”, counted once a second.

The code keeps one loader per scene. A second loader in the same scene removes only its own component and logs a line that says its object stays. A loader of another scene stays. The warning the Inspector shows in Edit mode says it destroys the whole GameObject. The runtime code removes the component only.

It does nothing on a multiplayer client, where the host’s runtime actors arrive as records. It also does nothing while a load across scenes waits for its scene, because the game scene brings them. Calling RuntimeActorLoaderBase.Load() follows the same rules, and does nothing without a loader in the game.