美文网首页
Unity 跳过自带的启动屏/Logo

Unity 跳过自带的启动屏/Logo

作者: 深吸一口气 | 来源:发表于2023-02-17 21:08 被阅读0次

原文:https://blog.csdn.net/final5788/article/details/127250771

#if !UNITY_EDITOR
using UnityEngine;
using UnityEngine.Rendering;
 
[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

相关文章

网友评论

      本文标题:Unity 跳过自带的启动屏/Logo

      本文链接:https://www.haomeiwen.com/subject/bprvkdtx.html