只需要写个静态方法,使用[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSplashScreen)]即在在显示启动画面之前调用这个静态方法,在静态方法中调用SplashScreen.Stop(SplashScreen.StopBehavior.StopImmediate)来立即停止启动屏。


使用方法:

1. 将下面脚本文件直接作为Runtime代码放到项目任意位置。(不是Editor代码,是运行时代码)

2. 打包->运行。果然,Unity Logo消失了,快速干净清爽。非常好用,无需破解,官方支持,全平台适用。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
using UnityEngine;
using UnityEngine.Rendering;
using 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
}
using UnityEngine; using UnityEngine.Rendering; using 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 }
using UnityEngine;
using UnityEngine.Rendering;
using 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
}

 

点赞

发表回复

昵称和uid可以选填一个,填邮箱必填(留言回复后将会发邮件给你)
tips:输入uid可以快速获得你的昵称和头像(已失效)

  • 小电视

欢迎阅读『Unity-个人版Unity如何跳过UnityLogo』