I want to code my own custom “switch” or “conditional branch on” node. How can I do that?
Hi @unity-huunity!
To create your own conditional branching node, you can create a custom Sequencing node. This can be achieved by right clicking on the canvas, and selecting “Create new > Sequencing”:
This will open the node creation wizard that allows you to create a new node step by step. You can give your sequencing node a description (similar to Action nodes) and define custom output ports that you can hook your custom logic into.
After confirming the creation of your new Sequencing node, a C# script should open where you can fill in your own custom logic. For reference on how to achieve something like a Switch, you can take a look at the code behind the built-in Switch node which can be found from the Muse Behavior package under /Runtime/Execution/Nodes/Composites/Switch.cs
.
Hope this helped, and please let us know if you need any further assistance with creating your custom nodes.
wow, thank you for such great answer!