On app quit

Hello, so my question is pretty simple. I need to delete a file when the game is closed. I tried with OnApplicationQuit but it executes when changing scenes and I dont want that.

OnApplicationQuit shouldn’t fire when changing scenes.

How are you changing scenes?

SceneManager.LoadScene(“Main”);