I have a question regarding the Unity splash screen.
I assumed Unity loads and awakes the first scene in “Scenes in Build” list, while the splash screen is displayed.
However, it seems Unity loads/awakes the scene after the splash screen was displayed.
I configured the splash screen to last 10 seconds and added the following script to the first scene:
public class First : MonoBehaviour
{
void Awake()
{
Debug.LogFormat("First.Awake: time={0}", Time.realtimeSinceStartup);
}
void Start()
{
Debug.LogFormat("First.Start: time={0}", Time.realtimeSinceStartup);
}
void Update()
{
if (UnityEngine.Rendering.SplashScreen.isFinished)
{
Debug.LogFormat("First.Update: SplashFinished={0}, time={1}", UnityEngine.Rendering.SplashScreen.isFinished, Time.realtimeSinceStartup);
this.enabled = false;
}
}
}
All these Log’s come pretty much at the same time.
09-17 15:09:11.881 18359 18372 D Unity : OPENGL LOG: Creating OpenGL ES 3.0 graphics device ; Context level <OpenGL ES 3.0> ; Context handle -1200478448
09-17 15:09:11.884 18359 18372 D Unity : [EGL] Attaching window :0xb8361818
09-17 15:09:11.893 18359 18372 D Unity : Requested framebuffer: resolution[1280x800], rgba[8/8/8/8], depth+stencil[on], samples[1]
09-17 15:09:11.893 18359 18372 D Unity : Created framebuffer: resolution[1280x800], rgba[8/8/8/8], depth+stencil[24/8], samples[0]
09-17 15:09:11.894 18359 18372 D Unity : [EGL] Attaching window :0xb8361818
09-17 15:09:11.895 18359 18372 D Unity : Initialize engine version: 2018.4.4f1 (5440768ff61c)
09-17 15:09:11.932 18359 18372 D Unity : Begin MonoManager ReloadAssembly
09-17 15:09:12.818 18359 18372 D Unity : - Completed reload, in 0.886 seconds
09-17 15:09:13.148 18359 18372 D Unity : PlayerInitEngineGraphics OK
09-17 15:09:13.153 18359 18372 D Unity : Found 7 native sensors
09-17 15:09:13.156 18359 18372 D Unity : Sensor : Accelerometer ( 1) ; 0.010000 / 0.00s ; kxtj9-accel / Kionix
09-17 15:09:13.159 18359 18372 D Unity : Sensor : Accelerometer ( 1) ; 0.010000 / 0.00s ; kxtj9-accel / Kionix
09-17 15:09:13.176 18359 18372 D Unity : SetWindow 0 0xb83fe850
09-17 15:09:13.176 18359 18372 D Unity : [EGL] Attaching window :0xb83fe850
09-17 15:09:13.193 18359 18372 D Unity : ANativeWindow: (1280/800) RequestedResolution: (0/0) RenderingResolution: (0/0) EGLSurface: (1280/800)
09-17 15:09:23.340 18359 18372 D Unity : UnloadTime: 13.021000 ms
09-17 15:09:23.356 18359 18372 D Unity : UUID: xxx
09-17 15:09:23.827 18359 18372 I Unity : First.Awake: time=10.12555
09-17 15:09:23.827 18359 18372 I Unity :
09-17 15:09:23.866 18359 18372 D Unity : Sensor : Accelerometer ( 1) ; 0.010000 / 0.00s ; kxtj9-accel / Kionix
09-17 15:09:23.875 18359 18372 D Unity : Choreographer available: Enabling VSYNC timing
09-17 15:09:23.897 18359 18372 I Unity : First.Start: time=10.63175
09-17 15:09:23.897 18359 18372 I Unity :
09-17 15:09:24.001 18359 18421 D Unity : Setting up 1 worker threads for Enlighten.
09-17 15:09:24.006 18359 18422 D Unity : Thread -> id: ffffffff9bc9b930 -> priority: 1
09-17 15:09:24.377 18359 18372 I Unity : First.Update: SplashFinished=True, time=11.10229
09-17 15:09:24.377 18359 18372 I Unity :
09-17 15:09:30.532 18359 18359 I Unity : windowFocusChanged: false
09-17 15:09:30.590 18359 18359 I Unity : onPause
09-17 15:09:30.692 18359 18372 D Unity : Sensor : Accelerometer ( 1) ; 0.010000 / 0.00s ; kxtj9-accel / Kionix
09-17 15:09:30.726 18359 18372 D Unity : SetWindow 0 0x0
I assumed Awake() and Start() would be called about the same time the splash screen appears, but they are called after 10secs, when the splash screen finished.
I want to execute code during the splash screen to async load further scenes to minimize loading times to the first interactible scene.
Tested with Unity 2018.4.1f1 on Android and Windows Standalone.
4971956–484352–splashscreen_problem.zip (23.3 KB)