When application closes, Do This()

Hey All,

I haven’t been able to find any information on this, however, perhaps someone may know?

[-pseudo code-]
OnApplicationUnLoad
Do

Send UDP packet to server stating character is logging out.
close application.
End

[- /pseudo code-]

Any ideas?

I think if you use

but the above is only called if you actually leave the application I don’t think it gets called if your application/game gets killed by the os (like in Android)

Hi Raigex.

So if a person is using the application in Windows or Mac OSX, and they click the close button (in windows, the “X” in mac, the red “x” dot) this function will be called ?

Thanks for your response. I’m trying to handle the log out packet without having players still logged in until the server times out all players that have not sent a packet in the last 15 seconds or so.

Thanks again Raigex.

I have been able to create my server timer to timeout players after a specific time frame if the player’s client had crashed. And using the OnApplicationQuit() I have ensured that when the client is closed, the logout packet is sent to the server instantly logging said player out.