x


How do I setup a persistent guard to disconnect from server on exit?

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.

more ▼

asked Dec 21 '10 at 11:46 PM

jz87 gravatar image

jz87
282 36 44 48

(comments are locked)
10|3000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x56
x22
x4
x2
x1

asked: Dec 21 '10 at 11:46 PM

Seen: 592 times

Last Updated: Dec 21 '10 at 11:46 PM