I have the following setup: Login Scene (gets username/password, logs in) Static class containing reference to server object multiple level scenes that are dynamically loaded assuming logging is successful.
The problem is that the user can hit Alt-F4 or otherwise exit the application at any time. I need a guard object to detect this and disconnect from the server on exit. I don't want to copy and paste this code into the event handlers for every scene. Is there a root object or something I can attach the guard object to?
I tried attaching an Don't destroy object to an object in the login scene but then that scene won't unload.
asked Dec 21 '10 at 11:46 PM