Skip to main content
Action graphs are s&box’s visual scripting system. They let you wire together logic nodes to create gameplay behaviour without writing C# code. Each graph is stored as an ActionGraphResource asset (.action file) and can be loaded, invoked, or embedded in a component at runtime.

Creating an action graph

1

Create the asset

In the editor’s Asset Browser, right-click and choose New Asset → Action Graph. The file is saved with the .action extension.
2

Open the graph editor

Double-click the asset to open the node canvas. The graph has a title, description, category, and icon — editable in the asset properties panel.
3

Add nodes

Right-click the canvas to open the node picker, then search by name or category. Connect output pins to input pins to build your logic.
4

Assign to a component

Drag the .action asset onto an ActionsInvoker component property, or reference it from C# using ResourceLibrary.Get<ActionGraphResource>.

ActionGraphResource

ActionGraphResource is the engine class that backs every .action file. It derives from GameResource and wraps an ActionGraph object, deferring deserialization until the graph is first accessed so that types are guaranteed to be loaded.
// Load a graph asset at runtime
var resource = ResourceLibrary.Get<ActionGraphResource>( "path/to/mygraph.action" );
ActionGraph graph = resource.Graph;

// Inspect display metadata
string title = resource.Title;
string description = resource.Description;
string category = resource.Category;
string icon = resource.Icon;
The [AssetType] attribute registers it with the editor under the Action Graph category:
[AssetType( Name = "Action Graph", Extension = "action",
            Category = "Action Graph", Flags = AssetTypeFlags.NoEmbedding )]
public sealed class ActionGraphResource : GameResource { ... }

Invoking a graph from C#

The ActionsInvoker component bridges Action Graphs and the component lifecycle. Assign an Action delegate property (backed by a graph) and the invoker calls it at the appropriate moment:
// ActionsInvoker hooks graph execution into standard lifecycle events
public sealed class ActionsInvoker : Component
{
    [Property] public Action OnEnabledAction { get; set; }
    [Property] public Action OnUpdateAction { get; set; }
    [Property] public Action OnFixedUpdateAction { get; set; }
    [Property] public Action OnDisabledAction { get; set; }
    [Property] public Action OnDestroyAction { get; set; }
}
You can also invoke a graph manually from C# by resolving its ActionGraph and calling it directly:
var res = ResourceLibrary.Get<ActionGraphResource>( "mygraph.action" );
res?.Graph?.Invoke( targetObject );

Built-in node categories

Nodes are organised into categories in the picker. The table below lists the main built-in families.
Defined in SceneNodes (Sandbox.ActionGraphs). These nodes work with the scene graph and asset system.
Node IDTitleDescription
scene.getGet Gets a component from a target object
scene.get.insceneGet in SceneFinds the first active component of a type
scene.getall.insceneGet All in SceneFinds all active components of a type
scene.instantiateInstantiate PrefabCreates a prefab instance in the scene
scene.cloneClone Game ObjectMakes a copy of a GameObject
scene.findFind Object by NameFinds a GameObject by name
scene.findallFind Objects by NameFinds all GameObjects by name
scene.traceScene TraceReturns the scene’s trace builder
scene.netspawnNetwork SpawnSpawns a GameObject over the network
sound.playPlay SoundPlays a SoundEvent at a world position
Defined in CollectionNodes (Sandbox.ActionGraphs). These nodes create and manipulate generic collections.
Node IDTitle
array.newNew Array of
list.newNew List of
set.newNew Set of
dict.newNew Dictionary from to
list.getGet Item
list.setSet Item
Defined in UtilityNodes (Sandbox.ActionGraphs). These nodes handle type testing, conversion, and string formatting.
Node IDTitle
op.asAs
op.convertConvert
op.isnullIs Null
op.isnotnullIs Not Null
sys.tostringTo String
sys.tostring.formatTo String (Format)
sys.gethashcodeGet Hash Code
The RunSceneEventNodeDefinition node (ID scene.run) lets a graph dispatch a scene event to all components that implement an ISceneEvent<T> interface. Select the interface type and method name in the node’s property panel. You can optionally pin a target GameObject to scope the event to that object’s descendants.

Registering custom nodes

Decorate a static method with [ActionGraphNode( "your.node.id" )] to expose it as a node in the picker:
using Facepunch.ActionGraphs;

[ActionGraphNode( "mymod.greet" ), Pure, Title( "Greet Player" ), Category( "My Mod" )]
public static string GreetPlayer( string name )
{
    return $"Hello, {name}!";
}
  • [Pure] marks the node as side-effect free (no execution signal pins).
  • [Title] sets the display name in the picker.
  • [Category] groups the node in the picker hierarchy.
  • [Icon] sets a Material Icons glyph on the node header.
The node ID must be globally unique. Use a dotted namespace prefix (e.g. myaddon.category.action) to avoid collisions.

Build docs developers (and LLMs) love