public class Facepunch.ActionGraphs.ActionGraph
Represents an async method as a directed graph. Control will enter through an "event" node, which can route signals through a network of other nodes that perform actions. Use `Facepunch.ActionGraphs.ActionGraph.CreateEmpty(Facepunch.ActionGraphs.NodeLibrary)` to create a completely blank graph, or `Facepunch.ActionGraphs.ActionGraph.CreateDelegate`(Facepunch.ActionGraphs.NodeLibrary)` to create a graph that handles an event matching the signature of a particular delegate.
Related Guides
Broader workflow and conceptual references connected to this API.
Editor Events are events that are broadcast globally throughout the editor and can be listened to/fired from any Editor Project. These are useful for creating your own custom Editor Tools and making sure they can work in tandem with existing systems.
Here's how to do some common things. Each has a code you can copy to your clipboard, then Ctrl+V to paste in the ActionGraph editor.
ActionGraph is a visual scripting system that lets you create game logic using nodes instead of code. Connect nodes together to build behaviors, respond to events, and control your scene — all from a graphical editor.
An addon project adds to a Game Project. The addon project isn't published directly, you create assets and publish those individually.
Making a custom node in C# is as easy as writing a static method with a special \[ActionGraphNode( id )\] attribute. You should also add \[Pure\] if you want your node to be an expression node - a node without signals.
The easiest way to add an ActionGraph to your scene is through the Actions Invoker component. Just click Add Component on an object, then you can find it under Actions.
Methods
Showing 39 methods
public void AddRequiredNodes()
public Facepunch.ActionGraphs.Variable AddVariable(string name, System.Type type, object defaultValue = null)
Parameters
defaultValue: Default: null
public System.Linq.Expressions.LambdaExpression BuildExpression()
Builds a `System.Linq.Expressions.LambdaExpression` that implements this graph.
public bool CanCreateSubGraph(System.Collections.Generic.IEnumerable`1<Facepunch.ActionGraphs.Node> nodes)
public void ClearChanges()
Don't increment `Facepunch.ActionGraphs.ActionGraph.ChangeId` during next validation.
public static Facepunch.ActionGraphs.ActionGraph CreateEmpty(Facepunch.ActionGraphs.NodeLibrary nodeLibrary)
Creates a completely blank action graph. This won't be invokable until an event node is added.
Parameters
nodeLibrary: Source of node definitions for the new action graph.
public System.Threading.Tasks.Task`1<System.Nullable`1<Facepunch.ActionGraphs.CreateSubGraphResult>> CreateSubGraphAsync(System.Collections.Generic.IEnumerable`1<Facepunch.ActionGraphs.Node> nodes, System.Text.Json.JsonSerializerOptions jsonOptions, Facepunch.ActionGraphs.CreateSubGraphNodeDelegate createSubGraphNode)
public void Deserialize(string json, System.Type delegateType, System.Text.Json.JsonSerializerOptions options = null)
Restore a previously serialized graph from JSON in this instance.
Parameters
json: Serialized action graph.delegateType: Optional delegate type, must match the one used when serializing.options: Optional serializer options. Default: null
public System.Collections.Generic.IReadOnlyDictionary`2<string,object> Evaluate(System.Collections.Generic.IReadOnlyDictionary`2<string,object> inputs = null)
Parameters
inputs: Default: null
public System.Collections.Generic.IEnumerable`1<Facepunch.ActionGraphs.IActionGraphDelegate> GetDelegates()
Gets all known `Facepunch.ActionGraphs.IActionGraphDelegate`s created from this graph.
public Facepunch.ActionGraphs.Link InsertLink(Facepunch.ActionGraphs.Node.Input target, Facepunch.ActionGraphs.ILinkSource source, int index)
public System.Threading.Tasks.Task`1<System.Collections.Generic.IReadOnlyDictionary`2<string,object>> InvokeAsync(System.Collections.Generic.IReadOnlyDictionary`2<string,object> inputs = null, System.Collections.Generic.IReadOnlyDictionary`2<string,Facepunch.ActionGraphs.Compilation.OutputDelegate> outputs = null)
Parameters
inputs: Default: nulloutputs: Default: null
public static Facepunch.ActionGraphs.ActionGraph.SerializationOptionsScope PushCache(Facepunch.ActionGraphs.IActionGraphCache value, bool writeReferences)
public static Facepunch.ActionGraphs.ActionGraph.SerializationOptionsScope PushGuidMap(System.Collections.Generic.IReadOnlyDictionary`2<System.Guid,System.Guid> value)
public static Facepunch.ActionGraphs.ActionGraph.SerializationOptionsScope PushMakeGuidsUnique(bool value)
public static Facepunch.ActionGraphs.ActionGraph.SerializationOptionsScope PushSerializationOptions(Facepunch.ActionGraphs.SerializationOptions options)
public static Facepunch.ActionGraphs.ActionGraph.SerializationOptionsScope PushSourceLocation(Facepunch.ActionGraphs.ISourceLocation value)
public static Facepunch.ActionGraphs.ActionGraph.SerializationOptionsScope PushTarget(Facepunch.ActionGraphs.InputDefinition value)
public static Facepunch.ActionGraphs.ActionGraph.SerializationOptionsScope PushWriteCacheReferences(bool value)
public void RemoveLink(Facepunch.ActionGraphs.Link link)
public void RemoveNode(Facepunch.ActionGraphs.Node node)
Remove a node from this action graph. Any links into or out of the node will also be removed.
Parameters
node: Node to remove.
public void RemoveUnusedChildNodes()
public void RemoveVariable(Facepunch.ActionGraphs.Variable variable)
public string Serialize(System.Collections.Generic.IEnumerable`1<Facepunch.ActionGraphs.Node> nodes, System.Text.Json.JsonSerializerOptions options)
public System.Text.Json.Nodes.JsonNode SerializeToNode(System.Collections.Generic.IEnumerable`1<Facepunch.ActionGraphs.Node> nodes, System.Text.Json.JsonSerializerOptions options)
public System.Collections.Generic.IReadOnlyList`1<Facepunch.ActionGraphs.Link> SetLinks(Facepunch.ActionGraphs.Node.Input target, System.Collections.Generic.IEnumerable`1<Facepunch.ActionGraphs.ILinkSource> sources)
public void Validate(bool force = False)
Parameters
force: Default: False
No results match this filter.
Properties
Showing 25 properties
public string Facepunch.ActionGraphs.ActionGraph.Category { get; set; }
public int Facepunch.ActionGraphs.ActionGraph.ChangeId { get; set; }
Increments each time this graph re-validates after a change.
public string Facepunch.ActionGraphs.ActionGraph.Description { get; set; }
public Facepunch.ActionGraphs.DisplayInfo Facepunch.ActionGraphs.ActionGraph.DisplayInfo { get; set; }
public System.Guid Facepunch.ActionGraphs.ActionGraph.Guid { get; set; }
public string Facepunch.ActionGraphs.ActionGraph.Icon { get; set; }
public Facepunch.ActionGraphs.Node Facepunch.ActionGraphs.ActionGraph.InputNode { get; set; }
Entry point of the graph.
public System.Collections.Generic.IReadOnlyDictionary`2<string,Facepunch.ActionGraphs.InputDefinition> Facepunch.ActionGraphs.ActionGraph.Inputs { get; set; }
public Facepunch.ActionGraphs.NodeKind Facepunch.ActionGraphs.ActionGraph.Kind { get; set; }
public System.Collections.Generic.IReadOnlySet`1<Facepunch.ActionGraphs.Link> Facepunch.ActionGraphs.ActionGraph.Links { get; set; }
Set of links added between nodes in this action graph.
public System.Collections.Generic.IReadOnlyCollection`1<Facepunch.ActionGraphs.ValidationMessage> Facepunch.ActionGraphs.ActionGraph.Messages { get; set; }
public virtual sealed Facepunch.ActionGraphs.NodeLibrary Facepunch.ActionGraphs.ActionGraph.NodeLibrary { get; set; }
Library of node definitions available for use by this action graph.
public System.Collections.Generic.IReadOnlyDictionary`2<int,Facepunch.ActionGraphs.Node> Facepunch.ActionGraphs.ActionGraph.Nodes { get; set; }
Set of nodes added to this action graph.
public System.Collections.Generic.IEnumerable`1<Facepunch.ActionGraphs.Node> Facepunch.ActionGraphs.ActionGraph.OutputNodes { get; set; }
Nodes that emit return values or output signals from this graph to the caller.
public System.Collections.Generic.IReadOnlyDictionary`2<string,Facepunch.ActionGraphs.OutputDefinition> Facepunch.ActionGraphs.ActionGraph.Outputs { get; set; }
public Facepunch.ActionGraphs.Node Facepunch.ActionGraphs.ActionGraph.PrimaryOutputNode { get; set; }
Primary output of the graph.
public static Facepunch.ActionGraphs.SerializationOptions Facepunch.ActionGraphs.ActionGraph.SerializationOptions { get; set; }
public Facepunch.ActionGraphs.ISourceLocation Facepunch.ActionGraphs.ActionGraph.SourceLocation { get; set; }
Identifies where this instance was deserialized from.
public virtual sealed string Facepunch.ActionGraphs.ActionGraph.StackTraceIdentifier { get; set; }
public string[] Facepunch.ActionGraphs.ActionGraph.Tags { get; set; }
public Facepunch.ActionGraphs.InputDefinition Facepunch.ActionGraphs.ActionGraph.TargetDefinition { get; set; }
The definition of the graph input that represents the target of the graph.
public Facepunch.ActionGraphs.Node.Output Facepunch.ActionGraphs.ActionGraph.TargetOutput { get; set; }
The output of the graph's entry node that represents the target of the graph.
public string Facepunch.ActionGraphs.ActionGraph.Title { get; set; }
public System.Text.Json.Nodes.JsonObject Facepunch.ActionGraphs.ActionGraph.UserData { get; set; }
Arbitrary named values stored in this action graph, which will be included during serialization. Values must be serializable to JSON.
public System.Collections.Generic.IReadOnlyDictionary`2<string,Facepunch.ActionGraphs.Variable> Facepunch.ActionGraphs.ActionGraph.Variables { get; set; }
Set of variables added to this action graph.
No results match this filter.
Metadata
| Field | Value |
|---|---|
| Namespace | Facepunch.ActionGraphs |
| Type | class |
| Assembly | Facepunch.ActionGraphs |
| Doc ID | T:Facepunch.ActionGraphs.ActionGraph |