unity on scene unload code example Example: unity calling method before unloading scene SceneManager.sceneUnloaded += MyFunction;