simple question. js script. opposite to start function.

Hi there. Just a quick question.

I’ve got a scene which uses a js script. I’m using the

function Start () {}

function when the scene loads. All straightforward so far, but what is the function for when the scene is closed? Either by quitting the program, loading another scene, or when the play button is then unchecked inside unity?

Many thanks.

Hi, in order to manage the game quit you can use

function OnApplicationQuit () {}

For the other cases you have to manage them by yourself, you can do it using functions and flags defined by you