Updating Variables From a paused scene

Ok so I have a shop mechanic.
I want to be able to take my two main Global Variables which are listed below.

The shop page is a separate scene, So I want to be able to buy ammo, then when returning to the main scene the ammo count is updated, I have everything set as global objects so that isn’t the problem, It’s trying to get the variable to update when on the second scene.


I got a feeling I have to use the new same features for this, but no idea where to start, but just figured I would ask first.

There are NO global variables in your screenshot
In fact i see only object variable
I never tested if global objects variables are also global but since you are here i assume not

IDK why you went with object variables instead of global variables?

Where to solve your problem you could simply set global variable to scene object variable and then when changing scene set object variable to global variable and that is how you would fix your issue

But then again what’s the point in that if you could simply use global variables from the start?

2 Likes

Ok so for the variables using the fire bullet behaviour. How can I make them global then?
Or match the logic?

Oh never mind I see what your talking about.

I think you are confusing global objects with global variables

Technically in game making you want to avoid object variables if you can
IF your stuff should exist between scenes
Like for example when i make experience or level or hp variables or even ammo variable
I never make it object vars i always make global structure or array and store whatever i need as child vars there
And i have no problem with reading them between scenes

ALSO when you have object variable
And you delete object in game
You also delete it variables
NOT always but it can generate problems so its better to avoid it