Creating your first s&box project takes only a few minutes. The editor handles project scaffolding, scene management, and code compilation — you focus on placing GameObjects, attaching components, and pressing Play. This page walks through the complete flow from an empty editor to a running game.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/facepunch/sbox-public/llms.txt
Use this file to discover all available pages before exploring further.
Make sure you have the s&box editor installed before continuing. See the Installation guide if you haven’t set it up yet.
Create a new project
Open the editor
Launch s&box from Steam (or run the editor binary if you built from source). The main menu appears with a list of your existing projects.
Create a project
Click New Project. Give your project a name and choose a folder on disk. The editor generates the project structure — a
.sbox project file, a code/ folder for C# source, and an Assets/ folder for scenes, materials, and other assets.Set up a scene
Every s&box game runs aScene — a hierarchy of GameObject nodes. When you create a project, the editor starts with a blank scene. Set it up with the basics:
Add a directional light
In the Scene panel (the hierarchy on the left), right-click and choose Add GameObject. Name it
DirectionalLight. In the Inspector panel on the right, click Add Component and search for DirectionalLight. This illuminates your scene.Add a camera
Add another GameObject named
Camera. Add a CameraComponent to it. The active camera determines what the player sees at runtime.Add a ground plane
Add a third GameObject named
Ground. Add a ModelRenderer component and set its model to the built-in models/dev/plane.vmdl (or any flat model). Add a BoxCollider component so objects don’t fall through it.Write your first component
Components are C# classes that extendComponent. They live in your project’s code/ folder and hot-reload when you save.
Create a script
In the Assets browser at the bottom of the editor, navigate into
code/. Right-click and choose New Script. Name the file Spinner.cs.Write the component
Open
Spinner.cs in your IDE. Replace the contents with the following:OnUpdate is called every frame while the component is active. Time.Delta is the time in seconds since the last frame — multiply by it to keep movement frame-rate independent.Attach the component to a GameObject
Save the file. The editor recompiles automatically. In the Scene panel, select your
Ground GameObject (or create a new one). In the Inspector, click Add Component, search for Spinner, and add it. You’ll see the Speed property appear because it’s marked with [Property].Run the game
Press Play
Click the Play button in the toolbar (or press F5). The editor enters Play mode. The scene begins executing:
OnStart runs once per component, then OnUpdate runs every frame.Observe the result
If you attached
Spinner to your Ground object, it will rotate around the Y axis at 90 degrees per second. You can adjust the Speed property in the Inspector while the game is running — changes take effect immediately thanks to hot-reloading.Component lifecycle reference
The table below shows the order in which the engine calls component methods:| Method | When it runs |
|---|---|
OnAwake | Once, when the component is first initialized |
OnEnabled | When the component (or its GameObject) becomes active |
OnStart | Once, just before the first OnUpdate call |
OnUpdate | Every frame while enabled |
OnFixedUpdate | On a fixed interval, aligned with the physics tick |
OnPreRender | Every frame, just before the scene is rendered (client only) |
OnDisabled | When the component (or its GameObject) becomes inactive |
OnDestroy | Once, when the component is destroyed |
Next steps
Scene & GameObjects
Learn how the scene hierarchy works and how GameObjects relate to each other.
Components
Explore the full component API, including properties, tags, and component queries.
Scripting basics
Deeper dive into C# scripting patterns used in s&box.
Networking overview
Add
[Sync] properties and RPCs to make your game multiplayer.