From 4db89019dd5c1a73137768efd9fd9748f0fd674b Mon Sep 17 00:00:00 2001 From: ALEXTANG <574809918@qq.com> Date: Fri, 12 May 2023 23:41:59 +0800 Subject: [PATCH] [+] Enable Skip Unity Logo [+] Enable Skip Unity Logo --- .../Runtime/Utility/BeforeSplashScreen.cs | 34 +++++++++++++++++++ .../Utility/BeforeSplashScreen.cs.meta | 11 ++++++ 2 files changed, 45 insertions(+) create mode 100644 Assets/TEngine/Runtime/Utility/BeforeSplashScreen.cs create mode 100644 Assets/TEngine/Runtime/Utility/BeforeSplashScreen.cs.meta diff --git a/Assets/TEngine/Runtime/Utility/BeforeSplashScreen.cs b/Assets/TEngine/Runtime/Utility/BeforeSplashScreen.cs new file mode 100644 index 00000000..63e8e3ca --- /dev/null +++ b/Assets/TEngine/Runtime/Utility/BeforeSplashScreen.cs @@ -0,0 +1,34 @@ +#if UNITY_EDITOR && SKIP_UNITYLOGO +using UnityEngine; +using UnityEngine.Rendering; + +/// +/// 跳过UnityLogo +/// +[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 \ No newline at end of file diff --git a/Assets/TEngine/Runtime/Utility/BeforeSplashScreen.cs.meta b/Assets/TEngine/Runtime/Utility/BeforeSplashScreen.cs.meta new file mode 100644 index 00000000..0a1b330a --- /dev/null +++ b/Assets/TEngine/Runtime/Utility/BeforeSplashScreen.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 31d5fedb24d4b5f40a58dbcf9ee66c70 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: