Files
TEngine/Assets/TEngine/Runtime/Utility/BeforeSplashScreen.cs
ALEXTANG 4db89019dd [+] Enable Skip Unity Logo
[+] Enable Skip Unity Logo
2023-05-12 23:41:59 +08:00

34 lines
832 B
C#

#if UNITY_EDITOR && SKIP_UNITYLOGO
using UnityEngine;
using UnityEngine.Rendering;
/// <summary>
/// 跳过UnityLogo
/// </summary>
[UnityEngine.Scripting.Preserve]
public class SkipUnityLogo
{
[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()
{
SplashScreen.Stop(SplashScreen.StopBehavior.StopImmediate);
}
#endif
}
#endif