Creating New Nodes in Script Canvas

Script Canvas is an extensible visual scripting system. You can create new nodes in Script Canvas in the following four ways, listed in relative order of complexity:

  • Script Canvas functions
  • Script events
  • Behavior context binding
  • Custom nodes

Functions

One of the simplest ways to create a new node is by combining the functionality of several existing nodes into one reusable function node. Use Script Canvas Editor to create function nodes—there’s no need to write any C++ code.

Script Canvas function node example

Note:
Script Canvas functions are not available outside of the Script Canvas scripting system.

For more information, refer to Script Canvas Functions .

Script events

You can create new sender and receiver event nodes in Script Canvas using Asset Editor. Configure a script event in Asset Editor by supplying the event name, parameters, and return value—similar to defining a function in any programming language, but with no C++ code required.

Script event node example

Note:
Script events are available to all O3DE scripting systems, including Lua.

For more information, refer to Script Events .

Behavior context binding

To expose new C++ classes, methods, constants, data types, and events to Script Canvas, you can create script bindings to the behavior context. This is the most common method used to create new nodes for O3DE Gems and components.

Example node created from behavior context binding

Note:
You can use script bindings with any O3DE scripting system that uses the behavior context, such as Lua.
Note:
You don’t need to specify a dependency on the Script Canvas Gem to create script bindings that reflect to the behavior context.

For more information, refer to Creating Script Canvas Nodes from the Behavior Context in the Script Canvas Programmer Guide.

Custom nodes

For the most control and flexibility when creating new nodes, including the ability to add new functionality, you can use nodeables, a highly customizable node implementation mechanism. To create custom Script Canvas nodes, nodeables use XML configuration, Jinja templates, and an automatic C++ code generation tool. Programmers can use nodeables to write classes in C++ using an SDK that is guaranteed to generate a class interface that provides both a usable node in Script Canvas Editor and a usable object at runtime.

Example node created from nodeables

Note:
Nodeables are not available to other O3DE scripting systems, such as Lua.
Note:
Gems that use nodeables to provide custom Script Canvas nodes must specify a dependency on the Script Canvas Gem.

For more information, refer to Creating Custom Nodes in Script Canvas in the Script Canvas Programmer Guide.


Copyright © 2022 Open 3D Engine Contributors

Documentation Distributed under CC BY 4.0.
For our trademark, privacy and antitrust policies, code of conduct, and terms of use, please click the applicable link below or see https://www.lfprojects.org.


The Linux Foundation has registered trademarks and uses trademarks. For a list of trademarks of The Linux Foundation, please see our Trademark Policy page.