Hi! :) I'm crashing the head on understanding variables differences... Maybe someone could help me. ^^ Global variable is persistent, through scene and saving/loading. I got it. But i cannot understand very well object and local ones. For example, i tried to set an object variable: my event is simple. It starts with check the variable "used" if it is on yes or not, if not it perform the event, that go on changing the variable to yes and finish with starting a battle. If it is already used, the event only display a dialogue box. Pitifully, the event doesn't work and it just shift to dialogue box as battle was already performed... If i change to global variable, keeping same names and values, if works fine. So i am asking, what i didn't get about object variables? I thought they were just linked to an object but they were persistent and saved through games. Did i misunderstood something? About local, that should be only on current scene/battle/game, can you give me an example of usage? I would prefer not to have so many global variables set in my game if there is no necessity!
Global game variables are accessible everywhere at any time. Object game variables are bound to an object, and require the object to exist and have an Object Variables component attached. Their variables are unique to that object, but can be shared between objects using the same Object ID. Local variables are only available during a running event, e.g. in a battle event or game event - as soon as the event is over, the variables are gone.
Global and object variables are saved/persistent :)
Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found. If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Global game variables are accessible everywhere at any time.
Object game variables are bound to an object, and require the object to exist and have an Object Variables component attached. Their variables are unique to that object, but can be shared between objects using the same Object ID.
Local variables are only available during a running event, e.g. in a battle event or game event - as soon as the event is over, the variables are gone.
Global and object variables are saved/persistent :)
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
My old entry for Indie Game Making Contest 2015