SimulateAsyncMono.cs 843 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #if UNITY_EDITOR
  2. using UnityEngine;
  3. namespace XGame.Framework.Asset
  4. {
  5. class SimulateAsyncMono : MonoBehaviour
  6. {
  7. static SimulateAsyncMono _instance;
  8. public static SimulateAsyncMono Instance
  9. {
  10. get
  11. {
  12. if (!_instance)
  13. {
  14. _instance = new GameObject("SimulateAsync").AddComponent<SimulateAsyncMono>();
  15. DontDestroyOnLoad(_instance);
  16. }
  17. return _instance;
  18. }
  19. }
  20. public void Init()
  21. {
  22. }
  23. public static void Dispose()
  24. {
  25. if (_instance != null)
  26. {
  27. _instance.StopAllCoroutines();
  28. DestroyImmediate(_instance);
  29. _instance = null;
  30. }
  31. }
  32. }
  33. }
  34. #endif