Logo.cs 659 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using System;
  2. using UnityEngine;
  3. using UnityEngine.SceneManagement;
  4. using System.Collections;
  5. public class Logo : MonoBehaviour
  6. {
  7. #region
  8. public bool LoadComplete;
  9. #endregion
  10. private void Start()
  11. {
  12. StartCoroutine(Load());
  13. }
  14. private IEnumerator Load()
  15. {
  16. AsyncOperation async = SceneManager.LoadSceneAsync(1);
  17. async.allowSceneActivation = false;
  18. while (!LoadComplete || Math.Abs(async.progress - 0.9f) > 0.0005f)
  19. {
  20. yield return null;
  21. }
  22. async.allowSceneActivation = true;
  23. }
  24. public void complete()
  25. {
  26. LoadComplete = true;
  27. }
  28. }