Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: playmakerNewb on July 16, 2012, 03:41:48 PM
-
I currently have a few global variables that I use throughout my game. I've found that even if I do a complete re-load of my scene, that my global variables do not reset themselves.
1. Is this expected? If I'm reloading a scene, then why aren't globals reset?
2. If this is normal behavior, then how can I access all global vars to make sure that they're all reset prior to re-load?
Are there any inherit API functions that will allow me to "get all" variables, then reset them back to default values?
Thanks.
-
hi,
yes, they are not resetting, and I am not aware of any api to reset global variables to their default value. So the option you have is to listen to level load ( there is a system even call "LEVEL LOADED" in playmaker) change and set your various globals again
bye,
Jean
-
I was afraid of that.
I ended up putting some code into my own level loader that I'm using that wipes out all global bools. For the time being, this works, but I'm hoping for a better implementation in the future, or a way to destroy all global variables associated with a scene when a new scene is loaded...
-
Old topic, but I just found the same problem still exists.
Please explain why don't global variables reset to their default value, when the application is exited and restarted.
Why do they have a default setting if you must set them to some default value every time you start the application?
Thanks in advance:
szomaza
-
i agree, its a bit of a strange behavior...
-
Hi,
I think we are getting confused here.
What do you mean by "exited" and "restarted", global variables values persists as long as the application runs, if you stop the app and restarte the global variable will use the value defined in Unity.
Are you testing on mobile? else what platform are you testing on?
Bye,
Jean
-
I am testing in Unity on Windows.
I press play to run the application, then press play again to stop running it. ("exit" the application)
Then to "restart" I press play again.
-
This is probably a bug. The editor behavior changes subtly in each version of Unity sometimes breaking things that worked before. What version of Unity are you using? Try closing the Globals Window when entering/exiting play mode.
-
Hi,
I'm having this problem now in Unity 5 and latest PM build.
When I stop playing in editor and restart the game the global variable values haven't been reset to their initial values.
e.g. X=0 as default
press play and during game X is changed to 5
stop game
start game again and X still equals 5 at the start.
Thanks.
-
Edit - it seems sometimes they reset and sometimes (mostly) they don't and retain their in-game values after quitting the preview.
-
Hi,
ok, can you report this viy the bug reporting tool? Thanks
Unity menu: "PlayMaker/Tools/Sbmit bug Report"
Bye,
Jean