UI update 02
This commit is contained in:
@@ -2,6 +2,7 @@ using System.Collections;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
using Bansonic;
|
||||
|
||||
public class BootLoader : MonoBehaviour
|
||||
{
|
||||
@@ -19,6 +20,8 @@ public class BootLoader : MonoBehaviour
|
||||
[Tooltip("Optional Text to show loading percentage.")]
|
||||
[SerializeField] private Text progressText;
|
||||
|
||||
private bool transitionStarted;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
// Start the asynchronous loading process
|
||||
@@ -61,8 +64,16 @@ public class BootLoader : MonoBehaviour
|
||||
float elapsedTime = Time.time - startTime;
|
||||
if (elapsedTime >= minSplashTime)
|
||||
{
|
||||
// Allow the scene to activate
|
||||
asyncLoad.allowSceneActivation = true;
|
||||
if (!transitionStarted)
|
||||
{
|
||||
transitionStarted = true;
|
||||
if (gTransition.Run(AllowSceneActivationRoutine(asyncLoad)))
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
|
||||
asyncLoad.allowSceneActivation = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,4 +83,18 @@ public class BootLoader : MonoBehaviour
|
||||
// Restore screen sleep timeout
|
||||
Screen.sleepTimeout = SleepTimeout.SystemSetting;
|
||||
}
|
||||
|
||||
private IEnumerator AllowSceneActivationRoutine(AsyncOperation asyncLoad)
|
||||
{
|
||||
if (asyncLoad == null)
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
|
||||
asyncLoad.allowSceneActivation = true;
|
||||
while (!asyncLoad.isDone)
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user