0
Answered

Variables.Graph() usage

MikeChr 3 years ago updated by Lazlo Bonin (Lead Developer) 3 years ago 2

I am trying to use 'Variables.Graph(flowMachine).Set(tag, value);' to set a variable on the graph. Passing a FlowMachine is how the documentation describes it. I am getting a compile error “Argument 1: cannot convert from 'Bolt.FlowMachine' to 'Ludiq.GraphPointer'” on the flowMachine variable. I looked for a means of obtaining a GraphPointer from FlowMachine but no love. How do we get a GraphPointer in our scripts? Thanks.

Bolt Version:
Unity Version:
Platform(s):
Scripting Backend:
.NET Version (API Compatibility Level):

Found an answer for those interested. First need to build a GraphReference (typeof GraphPointer). 

FlowMachine flowMachine = GetComponent<FlowMachine>();
GraphReference graphref = GraphReference.New(flowMachine, true);
Variables.Graph(graphref ).Set("name", value);

Answered

Hey MikeChr! Thanks for pointing out that the manual was outdated. I updated the Variables API page to explain how to create and use graph references. Cheers!