APPExit.cs 669 B

12345678910111213141516171819202122232425262728293031323334
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class APPExit : MonoBehaviour
  5. {
  6. // Start is called before the first frame update
  7. void Start()
  8. {
  9. }
  10. // Update is called once per frame
  11. void Update()
  12. {
  13. }
  14. private void OnApplicationPause(bool pauseStatus)
  15. {
  16. if (pauseStatus)
  17. {
  18. Debug.Log("应用进入后台");
  19. // 在应用进入后台时执行的操作
  20. Application.Quit();
  21. }
  22. else
  23. {
  24. Debug.Log("应用返回前台");
  25. // 在应用返回前台时执行的操作
  26. }
  27. }
  28. }