本文主要是介绍Unity闪屏Logo去除,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
1.新建一个C#脚本,命名为 “SkipSplashScreen” (代码如下)。
using System.Collections;
using System.Collections.Generic;
using System;
using UnityEngine;
using UnityEngine.UI;#if !UNITY_EDITOR
using UnityEngine;
using UnityEngine.Rendering;public class SkipSplashScreen
{[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSplashScreen)]private static void BeforeSplashScreen(){
#if UNITY_WEBGLApplication.focusChanged += Application_focusChanged;
#elseSystem.Threading.Tasks.Task.Run(AsyncSkip);
#endif}#if UNITY_WEBGLprivate static void Application_focusChanged(bool obj){Application.focusChanged -= Application_focusChanged;SplashScreen.Stop(SplashScreen.StopBehavior.StopImmediate);}
#elseprivate static void AsyncSkip(){SplashScreen.Stop(SplashScreen.StopBehavior.StopImmediate);}
#endif
}
#endif
2.将 SkipSplashScreen 脚本,放到 Assets 目录下,打包并运行!
这篇关于Unity闪屏Logo去除的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!