[Unity] Loading Scene

sh·2024년 1월 4일

씬과의 이동 중에 로딩페이지를 보여주는 코드
다음씬의 오브젝트들을 로드한다

추후 수정예정*

using UI.Scene;
using UnityEngine;
using UnityEngine.SceneManagement;

namespace Scene
{
    public class LoadingScene : BaseScene
    {

        public string nextSceneLabel { get; set; }
        protected override bool Initialized()
        {
            if (!base.Initialized()) return false;
            UI.SetSceneUI<Loading_UI>();
            Debug.Log(Main.NextScene);
            LoadResourcesForNextScene(Main.NextScene);
            return true;
        }
       
        private void LoadResourcesForNextScene(string nextSceneLabel)
        {
            Main.Resource.AllLoadResource<Object>(nextSceneLabel, (key, currentCount, totalCount) =>
            {
                Debug.Log("Loading....");
                if (currentCount < totalCount) return;
                Main.Scenes.LoadNextSceneObject();
            });

        }
    }
}

0개의 댓글