Tremzoff 3 years ago updated by Lazlo Bonin (Lead Developer) 3 years ago 4

Hello there

First: I can hardly express how much I love Bolt! It's my no.1 asset :-)

Atm. I am trying to create one of the unity example projects (Flappy Bird example) with Bolt.
Now I am stuck at referencing. Please have a look at the following two scripts:

Game Controller Script: https://unity3d.com/de/learn/tutorials/topics/2d-game-creation/adding-game-controller?playlist=17093
Here: public static GameControl instance;  //A reference to our game control script so we can access it statically.

Bird Script: https://unity3d.com/de/learn/tutorials/topics/2d-game-creation/bird-script?playlist=17093
Here: GameControl.instance.BirdDied ();

How could I achieve the same - creating a reference and calling it - with Bolt? Or is it even unnecessary with Bolt?
I could already achieve the same result using Bolt's scene variables (kind of public variables), but in my opinion referencing
would be the better "style".


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

Anyone? I'd really appreciate any answer.


Hi TremZoff!

So if I understand your question correctly, you're looking for a singleton access to GameControl?

What I would do is:

  1. Create a GameControl object with a flow machine
  2. In that flow machine, have custom event listeners like "Bird Died"
  3. In the Start of that flow machine, set an Application Variable of "GameControl" to self
  4. In other graphs, use Trigger Custom Event (e.g. "Bird Died") and pass Get Application Variable "GameControl" as the target

Voilà! Let me know if this was unclear, don't have time to screenshot graphs right now.


Thank you for answering! I will try this and give feedback again here.

But one thing is still not really clear to me: Should I prefer singleton access (or referencing, as I called it above)

or public variables? I can pass data both ways but what's the better/cleaner approach?


In Bolt, all variables are public, except graph/flow variables. The design decision is up to you, it really depends on how you structure your project!