一个脚本跳过 Unity Logo 闪屏界面
需要 Unity2019.4 或更高版本。
将 SkipSplash.cs 放到你的项目任意目录下( Editor 除外)。
#if !UNITY_EDITOR
using UnityEngine;
using UnityEngine.Rendering;
public class SkipSplash
{
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSplashScreen)]
private static void BeforeSplashScreen()
{
#if UNITY_WEBGL
Application.focusChanged += Application_focusChanged;
#else
System.Threading.Tasks.Task.Run(AsyncSkip);
#endif
}
#if UNITY_WEBGL
private static void Application_focusChanged(bool obj)
{
Application.focusChanged -= Application_focusChanged;
SplashScreen.Stop(SplashScreen.StopBehavior.StopImmediate);
}
#else
private static void AsyncSkip()
{
//在程序起来的时候停止播放Splash
SplashScreen.Stop(SplashScreen.StopBehavior.StopImmediate);
}
#endif
}
#endif