LoadedGame
namespace Griff.Runtime;
public sealed class LoadedGameEverything needed to start a game: its component types, its start scene, how it loads its other scenes and prefabs, and the project it came from. Every host makes its games from one (NewGame): the player, windowed and as a server, the web player, the editor’s Play and Play with Players, and a balance simulation’s fights.
Properties
Section titled “Properties”Components
Section titled “Components”public ComponentRegistry Components { get; init; }The component types its scenes are read with (its scripts’ too).
Library
Section titled “Library”public PrefabLibrary? Library { get; init; }The project’s prefabs, read once each and copied for every spawn: the host’s own, kept across games (the editor’s, which reads a prefab again when it’s saved), or else one made for this game, whose prefabs never change.
Modules
Section titled “Modules”public IReadOnlyList<GameModule>? Modules { get; init; }The modules whose systems its games run (Modules): those its project uses (ProjectModules), or every one this program has if null.
Prefabs
Section titled “Prefabs”public Func<string, Entity>? Prefabs { get; init; }How an entity is made from a prefab by name, if not from the project’s prefabs.
Problems
Section titled “Problems”public ProblemLog Problems { get; init; }What loading it found wrong, said once (a game doesn’t say these again).
Project
Section titled “Project”public Project? Project { get; init; }The project (or exported game folder) it was loaded from, whose settings, scenes and prefabs it plays with. Null for a game made of a running one’s content (a simulation’s arena), which says how it loads scenes and prefabs itself.
public Scene Scene { get; init; }The scene it starts in.
SceneName
Section titled “SceneName”public string? SceneName { get; init; }The start scene’s name, for SceneName.
Scenes
Section titled “Scenes”public Func<string, Scene>? Scenes { get; init; }How another scene loads by name, if not from the project’s files: the editor plays the open scene as it is there, unsaved changes included.
StepRate
Section titled “StepRate”public int StepRate { get; init; }Steps a second of game time: the project’s, unless set.
Methods
Section titled “Methods”Deconstruct
Section titled “Deconstruct”public void Deconstruct(out Project? Project, out ComponentRegistry Components, out Scene Scene, out ProblemLog Problems)Equals
Section titled “Equals”public override bool Equals(object? obj)Equals
Section titled “Equals”public bool Equals(LoadedGame? other)GetHashCode
Section titled “GetHashCode”public override int GetHashCode()LoadPrefab
Section titled “LoadPrefab”public Entity LoadPrefab(string nameOrPath)Creates an entity from one of this game’s prefabs, for PrefabLoader.
LoadScene
Section titled “LoadScene”public Scene LoadScene(string nameOrPath)Loads another scene of this game by name, for SceneLoader.
NewGame
Section titled “NewGame”public Game NewGame(GameHostOptions? host = null)The game at its start scene, set up for the host that plays it (host: its input, sound, saves, network and where its problems are said): its other scenes and prefabs loaded from here, its title and components, and the project’s settings (UseProjectSettings). The one way a host makes a game, so a game starts the same in the editor, exported, in a browser and in a simulation.
ToString
Section titled “ToString”public override string ToString()