SkipLogo.cs 803 B

1234567891011121314151617181920212223242526272829303132
  1. #if !UNITY_EDITOR
  2. using UnityEngine;
  3. using UnityEngine.Rendering;
  4. using UnityEngine.Scripting;
  5. [Preserve]
  6. public class SkipLogo
  7. {
  8. [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSplashScreen)]
  9. private static void BeforeSplashScreen()
  10. {
  11. #if UNITY_WEBGL
  12. Application.focusChanged += Application_focusChanged;
  13. #else
  14. System.Threading.Tasks.Task.Run(AsyncSkip);
  15. #endif
  16. }
  17. #if UNITY_WEBGL
  18. private static void Application_focusChanged(bool obj)
  19. {
  20. Application.focusChanged -= Application_focusChanged;
  21. SplashScreen.Stop(SplashScreen.StopBehavior.StopImmediate);
  22. }
  23. #else
  24. private static void AsyncSkip()
  25. {
  26. SplashScreen.Stop(SplashScreen.StopBehavior.StopImmediate);
  27. }
  28. #endif
  29. }
  30. #endif