title: Call function after application close
body: <p>I need to call a function after closing the application (windows standalone application) and not OnApplicationClose() function.</p>
  
  <p>This function also depends on variables in the class (IntPtr variables).</p>
  
  <p>I tried to make this function as IEnumerator and call it from OnApplicationClose() but I don't know if this will work or if it is the right way:</p>
  
  <pre><code>void OnApplicationQuit()
  {
      StartCoroutine(OnClose());
  }
  
  private IEnumerator OnClose()
  {
      yield return new WaitForSeconds(5);
      // After close function
  }
  </code></pre>
  
  <p>My problem is that the function that I want to call after application quit takes a long time so I need to close the application first and then call this function.</p>