当前位置:   article > 正文

Unity闪屏Logo去除_unity微信小游戏 首屏logo动画闪个不停

unity微信小游戏 首屏logo动画闪个不停

1.新建一个C#脚本,命名为 “SkipSplashScreen” (代码如下)。

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

2.将 SkipSplashScreen 脚本,放到 Assets 目录下,打包并运行!

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/盐析白兔/article/detail/91924
推荐阅读
相关标签
  

闽ICP备14008679号