IN THIS ARTICLE
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 ascending order of complexity:
- Script Canvas functions
- Script events
- Behavior context binding
- Custom nodes
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.
Note:Script Canvas functions are not available outside of the Script Canvas scripting system.
For more information, refer to Script Canvas Functions.
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.
Note:Script events are available to all O3DE scripting systems, including Lua.
For more information, refer to Script Events.
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.
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.
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
- free function nodes, a customizable node reflecting C++ free function
To create custom Script Canvas nodes, we use XML configuration, Jinja templates, and an automatic C++ code generation tool. Programmers can use nodeables/free function nodes to write classes/functions 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.
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.
Note:Gems that use free function nodes to provide custom Script Canvas nodes must specify a dependency on the ScriptCanvas.Extensions target.
For more information, refer to Creating Custom Nodes in Script Canvas in the Script Canvas Programmer Guide.