Accessing Bolt variables through C# with additions

Hi!

I have a simple line of code that i can’t seem to figure out why it won’t work.

  • Variables.Saved.Set(“curRad”, - amount);

I wanna subtract my “curRad” saved variable from bolt with my int(amount).
But this logic currently just sets my curRad to whatever number my (amount) is.

I have tried so many other things aswell but i can’t seem to figure this out, a little pointer would be helpful.

I’ll need something more similiar to this i guess:
Variables.Saved.Set
(“curRad” = “curRad” -amount);

Any help would be appreciated

you would need something along the lines of

 curRad = (int)Variables.Object(gameObject).Get("BOLT_curRad");
 Variables.Saved.Set("BOLT_curRad", curRad - 1);

with a pre declared integer that you can change freely.
make sure you set you get the variable from unity before trying to use it.

1 Like

It worked thank you!

1 Like