s&box
RustCounter-Strike 2s&boxDeadlock
Wiki
Get s&box on Steam
Browse
OverviewGetting StartedCreating GamesEngine & ToolsDocumentationCommunity GamesResources
s&boxDocumentationSceneScenes
SOURCE 2 · C#
Build and play games with s&box.

Facepunch's game engine and creation platform — make games in C#, or jump straight into community games.

Get s&box on Steam

s&box Wiki

  • Overview
  • Getting Started
  • Creating Games
  • Engine & Tools
  • Documentation
  • Community Games
  • Resources

Tools & Community

  • Getting Started
  • Creating Games
  • Engine & Tools
  • Resources

Platforms

  • RustBattle
  • CSBattle
  • Rust Game Wiki
  • CS2 Skins Wiki
  • Deadlock Wiki

About

  • Official Site
  • Developer Wiki
  • GitHub
  • Get on Steam
NOT AFFILIATED WITH FACEPUNCH STUDIOS · © 2026 s&box Wiki (community)
Docs/Scene
Scene

Scenes

A scene is a collection of GameObjects.

To get the current scene you can use the Scene accessor on any GameObject, Component, or Panel. You can also access it via the static Game.ActiveScene.

To load a new Scene, you can do any of the following:

// Replaces the current scene with the specified scene
Scene.Load( myNewScene );
Scene.LoadFromFile( "scenes/minimal.scene" );

// Additively loads the specified scene on top of the current scene
var load = new SceneLoadOptions();
load.SetScene( myNewScene );
load.IsAdditive = true;
Scene.Load( load );

All scenes have a GameObject Directory. This holds all the GameObjects in the scene indexed by guid, and enforces that every object's guid is unique.

This also allows fast object lookups if you know the guid of the object.

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

The scene also holds a fast lookup index of every component. This allows you to quickly get every component of a certain type without having to keep your own lists, or iterate the entire scene.

// Tint all models a random colour
foreach ( var model in Scene.GetAll<ModelRenderer>() )
{
	model.Tint = Color.Random;
}

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

Source: Facepunch/sbox-docs (CC-BY-4.0) · updated 2025-06-15. Read it rendered on the official docs.

More in Scene

Advanced Topics
Async
Camera Effects
Component Interfaces
Component Methods
Component Versioning
Components
Events
← All documentation

Community wiki — not affiliated with Facepunch Studios. For the latest and most authoritative information, see the official developer wiki.