menu_bookDocumentation

Scenes: Loading, Directory Lookups, and Component Queries in s&box

calendar_today May 20, 2026 schedule ~1 min read person PatrickJr verified 50

A s&box Scene is a collection of GameObjects. Access the current scene via Scene on any GameObject/Component/Panel, or via Game.ActiveScene.

Loading Scenes

CSHARP
// Replace current scene
Scene.Load( myNewScene );
Scene.LoadFromFile( "scenes/minimal.scene" );

// Additive loading (on top of current scene)
var load = new SceneLoadOptions();
load.SetScene( myNewScene );
load.IsAdditive = true;
Scene.Load( load );

GameObject Directory

Every scene has a Directory indexing all GameObjects by GUID (enforces uniqueness). Enables fast lookups:

CSHARP
var obj = Scene.Directory.FindByGuid( guid );

Component Queries

The scene maintains a fast lookup index of every component by type:

CSHARP
// Get all components of a type
foreach ( var model in Scene.GetAll<ModelRenderer>() )
    model.Tint = Color.Random;

// Get a singleton
var game = Scene.Get<GameManager>();

These queries avoid iterating the entire scene hierarchy and don't require maintaining your own lists.

Was this helpful?