36 lines
1.1 KiB
C#
36 lines
1.1 KiB
C#
|
|
/* ---------------------------------------------------------------- */
|
||
|
|
/* Skip Unity Splash Screen */
|
||
|
|
/* Create by psygames */
|
||
|
|
/* https://github.com/psygames/UnitySkipSplash */
|
||
|
|
/* ---------------------------------------------------------------- */
|
||
|
|
|
||
|
|
#if !UNITY_EDITOR
|
||
|
|
using UnityEngine;
|
||
|
|
using UnityEngine.Rendering;
|
||
|
|
|
||
|
|
public class SkipSplash
|
||
|
|
{
|
||
|
|
[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
|