WorldLocation
WorldLocation tells you which scene the player is in. A scene is one area of the game, such as a building or a level, and it is loaded from a scene file.
WorldLocation the current scene and the scenes you know
Use CurrentScene for the scene the player is in, KnownScenes() for the scenes the game knows about, and VisitedScenes() for the ones the player has been to.
public static class WorldLocation
{
public static string CurrentScene { get; }
public static List<string> KnownScenes();
public static List<string> VisitedScenes();
}
| Property | Type | What it means |
|---|---|---|
CurrentScene | string | The name of the scene the player is in. |
| Method | Returns | What it does |
|---|---|---|
KnownScenes() | List<string> | Every scene name the game has. |
VisitedScenes() | List<string> | The scenes the player has visited in this save. |
Things to know
- For a scene change event, use
Events.SceneLoaded. It is not repeated here. KnownScenes()lists every scene name the game has. (The names come fromLevelNames.bytes.)VisitedScenes()lists the scenes the player has been to in the save they are playing. Each name appears once, and capital letters do not matter. It returns an empty list when there is no save, nevernull. (It joins four sources: the game’s own visited list (whenSaveSceneManagerexists), the active scene, the level files in the save folder (*.tnmt, exceptGlobalsandInfo), and the scenes entered this session. The game does not write its own list into a save, so the save-folder files are what keep a visit after a load.)- The “this session” part of
VisitedScenes()starts when the framework starts. It is cleared when a save is loaded from the load menu and whenMain MenuorOpen Sewer Introloads. Door changes keep it. - Saving to a new slot does not update the folder until the next load, so the active scene and the session set cover that.
Limits
Main MenuandOpen Sewer Introare never in the list. The game itself treats those two scenes as not part of play. After either of them loads, the save-folder files are ignored until the next load.- There is no “indoors” check. The game does not track whether the player is inside. (
InsideTriggeris for build-mode placement only.)