Accessing Bolt Variables from C# Code

Using bolt for the bulk of a projects can speed up development, however bolt doesn’t integrate with everything you may want to import into your projects like specialized assets from the unity asset store. To access the Bolt variables using c# code you can write small scripts what make use of one of the most powerful features in bolt.

using Bolt;
//**** SET ****
// Application Variables
Variables.Application.Set("DLC1_Owned", true);

// Scene Variables
Variables.ActiveScene.Set("Timer_Running", true);


//**** GET ****
//
(bool)Variables.ActiveScene.Get("Timer_Running");

This code lets the project know that you want to use Bolt references inside this script and then second line of code sets the Application level variable called “DLC!_Owned” to True (As it’s a bool variable)

Refernce: https://ludiq.io/bolt/manual/scripting/variables

Leave a Reply

Your email address will not be published. Required fields are marked *