Action Graphs are s&box’s node-based visual scripting system. They let you build game logic by connecting nodes in the editor without writing C# code — and they integrate seamlessly with components, so you can call graphs from code and wire code events into graphs. This page explains theDocumentation 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.
ActionGraphResource asset, how to create graphs in the editor, and how to use them from C#.
What is an Action Graph?
An Action Graph is aGameResource asset with the .action file extension. Each graph is a directed node graph — nodes represent operations (math, scene queries, component calls, flow control) and edges carry values between them. The engine provides nodes for every class and method marked with [ActionGraphNode], including the full Input API, GameObject manipulation, scene queries, and more.
Graphs are serialized as JSON and loaded via the ResourceLibrary, so they hot-reload alongside your C# code.
Creating a graph in the editor
Open the asset browser
In the s&box editor, open the Asset Browser panel. Navigate to the folder where you want to store the graph.
Create the asset
Right-click in the asset browser and choose New Asset → Action Graph. The new
.action file appears in the browser.Open the graph editor
Double-click the
.action file. The Action Graph editor opens, showing a blank canvas with an entry node.Add nodes
Right-click the canvas to open the node picker. Search by name or category. Drag connections between output and input pins to link nodes together.
Set the graph title and description
In the graph properties panel, set Title, Description, Category, and optionally an Icon (a Material Icon name). These fields appear in the asset browser and in the
DisplayInfo shown to the editor.ActionGraphResource
ActionGraphResource is the C# class that wraps a graph asset. It exposes the deserialized ActionGraph object, lazy-loaded on first access to avoid deserializing before game types are registered.
ActionGraph object is on resource.Graph. You typically do not need to access it directly — instead, use the component integration described below.
Using graphs from component properties
The most common way to use a graph is as anAction property on a component. The editor renders an Action Graph picker for any Action-typed [Property], letting designers assign a graph without touching C#.
Action properties on every Component for the standard lifecycle events:
| Property | When invoked |
|---|---|
OnComponentEnabled | After OnEnabled |
OnComponentStart | Before the first OnUpdate |
OnComponentUpdate | Each frame, after OnUpdate |
OnComponentFixedUpdate | Each fixed tick, after OnFixedUpdate |
OnComponentDisabled | After OnDisabled |
OnComponentDestroy | After OnDestroy |
The ActionsInvoker component
For cases where you want a pure visual-script object with no custom C# at all, add the built-in Actions Invoker component (Sandbox.ActionGraphs.ActionsInvoker). It exposes Action properties for all standard lifecycle events:
GameObject and wire graphs into its lifecycle hooks directly from the inspector.
Invoking a graph from code
If you need to invoke a graph imperatively (rather than via a property), load the resource and call through theActionGraph API:
ActionGraphResource.ActionGraphTargetType is typeof( GameObject ), so the graph’s execution context has access to the owning GameObject and all its components.Calling C# from a graph
Any static method or member decorated with[ActionGraphNode] appears as a node in the picker. The engine exposes thousands of nodes this way, including the full Input API (input.down, input.pressed, input.released, input.analog.look, input.analog.move) and scene manipulation methods.
To expose your own methods as nodes, add [ActionGraphNode]:
rocket_launch.
Graph metadata fields
| Field | Type | Description |
|---|---|---|
Title | string | Display name in the asset browser and editor |
Description | string | Short description shown in the editor |
Category | string | Groups the graph in asset browsers |
Icon | string | Material Icon name (default: account_tree) |
Tips and limitations
Hot-reloadable
Graphs reload when you save the
.action file — no restart required. C# type changes that affect node signatures also hot-reload.Debuggable
The Action Graph editor highlights the currently executing node when the game is running inside the editor, making it easy to step through logic visually.
No allocations for simple graphs
Graphs that use only value types and avoid closures are handled efficiently. Prefer action properties on components over runtime
Invoke calls in tight loops.Not a replacement for complex logic
Action Graphs excel at event-driven, designer-facing logic. For complex algorithms, numerical simulations, or performance-sensitive paths, write C# components instead.
Scripting basics
Writing C# components and exposing properties to the editor.
Input system
Input nodes are available directly inside Action Graphs.