Accessing a FlowCanvas graph from script?

FlowCanvas Forums Support Accessing a FlowCanvas graph from script?

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #2165

    Hey guys,
    I’m using the Unity Timeline/playables to control my game state over time. It’s a bit of a work around at the moment but I can trigger functions and change variables in C# scripts at runtime with this method.

    Is there a way to access custom flowcanvas functions and blackboard variables from external C# scripts? I’d like to use flowcanvas for more behaviors but I have to be able to trigger them through the timeline editor via C#.

    Sorry for the noobish question; I couldn’t find a good scripting reference on the topic.


    Hello 🙂

    Yes, it’s possible to call FlowCanvas Custom Functions as well as access (get/set) Blackboard variables in code.

    To call a Custom Function:
    – Get a reference to the FlowScriptController component attached on your gameobject and call the “CallFunction” method, like for example:
    Please note, that you can also pass parameters, if your Custom Function does take parameters, but there parameters need to be passed in correct order, like for example:
    GetComponent<FlowScriptController>().CallFunction("MyFunction", 10.5f, true)

    To access Blackboard and get/set their value:
    – Get a reference to the Blackboard component attached on the gameobject and use either ‘GetValue’ or ‘SetValue’ methods, like for example:
    var number = GetComponent<Blackboard>().GetValue<float>("myFloat");
    GetComponent<Blackboard>().SetValue("myFloat", 10.5f);

    Please let me know if that works for you.

    Join us on Discord:


    Yes! Thank you.

    It took me a bit to figure how I wanted to connect things but I’ve got it working nicely now.

    To noobs of the future: make sure you declare using FlowCanvas; and using NodeCanvas.Framework; at the top when you want to call a function and change a variable respectively.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.