├── .gitignore ├── LICENSE ├── README.md ├── README_EN.md └── SkipSplash.cs /.gitignore: -------------------------------------------------------------------------------- 1 | # This .gitignore file should be placed at the root of your Unity project directory 2 | # 3 | # Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore 4 | # 5 | /[Ll]ibrary/ 6 | /[Tt]emp/ 7 | /[Oo]bj/ 8 | /[Bb]uild/ 9 | /[Bb]uilds/ 10 | /[Ll]ogs/ 11 | /[Mm]emoryCaptures/ 12 | 13 | # Asset meta data should only be ignored when the corresponding asset is also ignored 14 | !/[Aa]ssets/**/*.meta 15 | 16 | # Uncomment this line if you wish to ignore the asset store tools plugin 17 | # /[Aa]ssets/AssetStoreTools* 18 | 19 | # Autogenerated Jetbrains Rider plugin 20 | [Aa]ssets/Plugins/Editor/JetBrains* 21 | 22 | # Visual Studio cache directory 23 | .vs/ 24 | 25 | # Gradle cache directory 26 | .gradle/ 27 | 28 | # Autogenerated VS/MD/Consulo solution and project files 29 | ExportedObj/ 30 | .consulo/ 31 | *.csproj 32 | *.unityproj 33 | *.sln 34 | *.suo 35 | *.tmp 36 | *.user 37 | *.userprefs 38 | *.pidb 39 | *.booproj 40 | *.svd 41 | *.pdb 42 | *.mdb 43 | *.opendb 44 | *.VC.db 45 | 46 | # Unity3D generated meta files 47 | *.pidb.meta 48 | *.pdb.meta 49 | *.mdb.meta 50 | 51 | # Unity3D generated file on crash reports 52 | sysinfo.txt 53 | 54 | # Builds 55 | *.apk 56 | *.unitypackage 57 | 58 | # Crashlytics generated file 59 | crashlytics-build.properties 60 | 61 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 psygames 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [(English)](README_EN.md) 2 | 3 | # UnitySkipSplash 4 | 5 | ## 简介 6 | - 一个脚本跳过 Unity Logo 闪屏界面。 7 | 8 | ## 使用方法 9 | - 需要 Unity2019.4 或更高版本。 10 | - 将 [`SkipSplash.cs`](https://github.com/psygames/UnitySkipSplash/blob/main/SkipSplash.cs) 放到你的项目任意目录下( `Editor` 除外)。 11 | - 完成,打包APP尽情享用吧~ 12 | 13 | ## 全部代码 14 | ```csharp 15 | /* ---------------------------------------------------------------- */ 16 | /* Skip Unity Splash Screen */ 17 | /* Create by psygames */ 18 | /* https://github.com/psygames/UnitySkipSplash */ 19 | /* ---------------------------------------------------------------- */ 20 | 21 | #if !UNITY_EDITOR 22 | using UnityEngine; 23 | using UnityEngine.Rendering; 24 | 25 | public class SkipSplash 26 | { 27 | [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSplashScreen)] 28 | private static void BeforeSplashScreen() 29 | { 30 | #if UNITY_WEBGL 31 | Application.focusChanged += Application_focusChanged; 32 | #else 33 | System.Threading.Tasks.Task.Run(AsyncSkip); 34 | #endif 35 | } 36 | 37 | #if UNITY_WEBGL 38 | private static void Application_focusChanged(bool obj) 39 | { 40 | Application.focusChanged -= Application_focusChanged; 41 | SplashScreen.Stop(SplashScreen.StopBehavior.StopImmediate); 42 | } 43 | 44 | #else 45 | private static void AsyncSkip() 46 | { 47 | SplashScreen.Stop(SplashScreen.StopBehavior.StopImmediate); 48 | } 49 | #endif 50 | 51 | } 52 | #endif 53 | ``` -------------------------------------------------------------------------------- /README_EN.md: -------------------------------------------------------------------------------- 1 | # UnitySkipSplash 2 | 3 | ## Intro 4 | - A script for Skipping Unity Logo Splash Screen. 5 | 6 | ## Usage 7 | - Require Unity2019.4 or higher. 8 | - Put [`SkipSplash.cs`](https://github.com/psygames/UnitySkipSplash/blob/main/SkipSplash.cs) into any folder of your Unity project (but `Editor`). 9 | - All done, build app and enjoy it. 10 | 11 | ## All Codes 12 | ```csharp 13 | /* ---------------------------------------------------------------- */ 14 | /* Skip Unity Splash Screen */ 15 | /* Create by psygames */ 16 | /* https://github.com/psygames/UnitySkipSplash */ 17 | /* ---------------------------------------------------------------- */ 18 | 19 | #if !UNITY_EDITOR 20 | using UnityEngine; 21 | using UnityEngine.Rendering; 22 | 23 | public class SkipSplash 24 | { 25 | [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSplashScreen)] 26 | private static void BeforeSplashScreen() 27 | { 28 | #if UNITY_WEBGL 29 | Application.focusChanged += Application_focusChanged; 30 | #else 31 | System.Threading.Tasks.Task.Run(AsyncSkip); 32 | #endif 33 | } 34 | 35 | #if UNITY_WEBGL 36 | private static void Application_focusChanged(bool obj) 37 | { 38 | Application.focusChanged -= Application_focusChanged; 39 | SplashScreen.Stop(SplashScreen.StopBehavior.StopImmediate); 40 | } 41 | 42 | #else 43 | private static void AsyncSkip() 44 | { 45 | SplashScreen.Stop(SplashScreen.StopBehavior.StopImmediate); 46 | } 47 | #endif 48 | 49 | } 50 | #endif 51 | ``` -------------------------------------------------------------------------------- /SkipSplash.cs: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------- */ 2 | /* Skip Unity Splash Screen */ 3 | /* Create by psygames */ 4 | /* https://github.com/psygames/UnitySkipSplash */ 5 | /* ---------------------------------------------------------------- */ 6 | 7 | #if !UNITY_EDITOR 8 | using UnityEngine; 9 | using UnityEngine.Rendering; 10 | 11 | public class SkipSplash 12 | { 13 | [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSplashScreen)] 14 | private static void BeforeSplashScreen() 15 | { 16 | #if UNITY_WEBGL 17 | Application.focusChanged += Application_focusChanged; 18 | #else 19 | System.Threading.Tasks.Task.Run(AsyncSkip); 20 | #endif 21 | } 22 | 23 | #if UNITY_WEBGL 24 | private static void Application_focusChanged(bool obj) 25 | { 26 | Application.focusChanged -= Application_focusChanged; 27 | SplashScreen.Stop(SplashScreen.StopBehavior.StopImmediate); 28 | } 29 | 30 | #else 31 | private static void AsyncSkip() 32 | { 33 | SplashScreen.Stop(SplashScreen.StopBehavior.StopImmediate); 34 | } 35 | #endif 36 | 37 | } 38 | #endif 39 | --------------------------------------------------------------------------------