Cannot Reproduce

API regarding variables

Jerm 2 years ago updated by Lazlo Bonin (Lead Developer) 2 years ago 4 1 duplicate

Looks like the API here needs an update. Because one cannot say

var graphReference = GraphReference.New(flowMachine);

GraphReference.New requires at least 2 arguments now. So the example should read.

var graphReference = GraphReference.New(flowMachine, TRUE);


  1. At the same time, I would love if we reminded folks learning bolt: all runtime graph changes, even through script, are permanent after exiting Play mode.
  2.  Oh also, remember to start scripts with using Bolt; using Ludiq;
Bolt Version:
Unity Version:
Scripting Backend:
.NET Version (API Compatibility Level):

Duplicates 1

Pending Review

Hi Jerm!

Thanks for the heads up. I updated the documentation with the missing parameter and added a section about usings.

I'll look into the runtime changes, it might be a bug. They should actually not be permanent if you're changing the variables on a FlowMachine. If you are changing them on a FlowMacro directly, then yes, these will get saved, because you're editing the definition asset.

Cannot Reproduce

Hi Jerm,

I tried to reproduce the issue of variable changes being persistent, and I couldn't.

They get properly reset on exiting play mode.

Here is my test setup:

  1. Create a flow macro with a single integer variable called "test"
  2. Create a C# script (below) that increments the variable every time space is pressed
  3. Attach a flow machine with the macro and attach the C# script to the same game object
  4. Enter play mode
  5. Increment the variable using Space
  6. Exit play mode
  7. The variable is reset to its initial value

The test script:

using UnityEngine;
using Bolt;
using Ludiq;

public class CS4162 : MonoBehaviour
    void Update()
        if (Input.GetKeyDown(KeyCode.Space))
            var flowMachine = GetComponent();
            var graphReference = GraphReference.New(flowMachine, true);
            var value = Variables.Graph(graphReference).Get("test");
            Variables.Graph(graphReference).Set("test", value);

The test setup:

I will therefore close this as Cannot Reproduce, feel free to comment again if you have clear reproduction steps.