Just uploaded the game I've been working on for the past 2 months on Kongregate. Pretty awesome. I have been working on and off on it for a while and now I can get back to posting on this blog. Play the game here!
So if you want to keep an object or script that keeps up variables (or for any other reason) when you go from scene to scene, you need to attach a don't destroy on load static function, which goes something like this: function Awake () { DontDestroyOnLoad (transform.gameObject); } The Awake function is call only once, when all the objects in the scene have been created. Read more about it here . DontDestroyOnLoad has what ever is in the ( ) to not be destroyed when creating a new scene. (transform.gameObject) is what will not be destroyed when the new scene is loaded, in this case, it will be the game object and all it's children the script is attached to.

Fun!
ReplyDeleteFYI:
ReplyDeleteTo get the correct game screen size, hold the control key + roll the middle mouse button.
Ctl+ mouse roller.
^the mouse wheel
ReplyDelete