forked from Jadekylin/UnitySkipSplash
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSkipSplash.cs
36 lines (33 loc) · 1.06 KB
/
SkipSplash.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/* ---------------------------------------------------------------- */
/* 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