Developer Guide (Version 1.11)

Script Canvas Best Practices

Best practices for Script Canvas include using an event-driven approach and using custom nodes to simplify your graphs.

Use an Event-Driven Approach

Script Canvas nodes are by default stateless. However, by connecting to the TickBus, they can be configured to have a state. Engineers must manage the lifetime and performance of nodes that have a state.

In the core Script Canvas libraries, state is used primarily to drive the execution of the graph (as with the Delay node). However, an event-driven paradigm is recommended because it helps reduce the complexity of authoring and executing graphs.

We recommend that you reflect functionality to Script Canvas through the behavior context. This is true even for Script Canvas–specific functionality. Using the behavior context encourages event-driven paradigms through EBuses. This approach yields modular, decoupled behaviors that can reduce graph complexity and takes advantage of execution optimizations.

Use Custom Nodes to Simplify Your Graphs

Identify frequently used but complicated user patterns and simplify them through custom nodes and/or improved behavior context methods. Using custom nodes with EBuses can reduce the overall complexity of graphs and make graph authoring more intuitive. For information on creating custom nodes, see Creating Custom Nodes in Script Canvas.