Automatic pause when device is turned off

Hi,

How can I detect when the user turns his device off, so I can put the game in pause-mode? (alternatively, detecting when the device is turned on should work just as well).

Thanks!

I haven’t tested pausing on device sleep, but the first place I would start is OnApplicationQuit().

Thanks, it wasn’t the correct method, but it lead me to the right one : OnApplicationPause().