KeepBetweenScenes
namespace Griff.Scenes;
public sealed class KeepBetweenScenes : ComponentCarries its entity (and everything inside it) into the next scenes the game goes to, still running: the player with their health and inventory from level to level, a music player that doesn’t restart, a score kept on screen. It becomes a top-level entity there, and with Replaces takes the place of an entity of the same name there (standing where that one stood), so there’s never two.
Going back to a scene it came from doesn’t make two either: the very same entity in it is replaced too. Arriving through a door (a door’s Arrive At) it stands where it arrives. Game.KeepBetweenScenes(entity) gives an entity one.
This is a component: its saved properties are on its component page.
Properties
Section titled “Properties”Replaces
Section titled “Replaces”public bool Replaces { get; set; }Takes the place of an entity with the same name in the next scene (where it stood), e.g. a level’s own “Player” or “Music”. Untick it to arrive as well as whatever’s there.