Skip to content

RememberScene

namespace Griff.Scenes;
public sealed class RememberScene : Component

Makes the scene it’s in remember how it was left: going to another scene and coming back finds it as it was (crates where they were pushed, enemies beaten, doors opened, pickups taken, a boss’s health) rather than as the scene file has it. One anywhere in the scene is enough. What’s in Forget comes back as the file has it every time, and so do things on their way out (anything with a Lifetime: bullets, sparks).

The scene is remembered as the game leaves it, with everything a saved game keeps, and put back exactly so (its scripts start again, as after loading a saved game). It’s remembered while the game runs and kept in saved games (Save Game); starting the scene over (Restart, Game.ReloadScene) forgets it, and so does New Game. Carried values (an inventory’s, a health’s or a counter’s Save As) are read again as it comes back, so they’re as the other scenes left them. In a network game the host remembers it.

This is a component: its saved properties are on its component page.

public string? Forget { get; set; }

Entities not to remember, by name, separated by commas: they come back as the scene file has them every time, e.g. “Enemies” for a group of enemies that are back each visit.