Android

[유니티3D엔진] 유니티 Scene 로딩

by badung007 posted Mar 21, 2014
?

단축키

Prev이전 문서

Next다음 문서

ESC닫기

크게 작게 위로 아래로 댓글로 가기 인쇄

   

    public IEnumerator IE_NextLoadLevel(string SceneName)
    {
        // async.progress pc버전에서는 안된다
        AsyncOperation async = Application.LoadLevelAsync( SceneName );

        while (async.isDone == false)
        {
            float p = async.progress * 100f;
            int pRounded = Mathf.RoundToInt(p);
            Popup_scene_loding.transform.FindChild("Progress_Label").GetComponent<UILabel>().text = pRounded.ToString() + "%";

            //LoadingBar를 NGUI로 하나 만들고 NGUI의 ProgressBar의 SliderValue 값에 넣어 줍니다.
            Popup_scene_loding.SetActive(true);
            Popup_scene_loding.transform.FindChild("Loding_Sprite").GetComponent<UISprite>().fillAmount = async.progress;
            Debug.Log(async.progress);
            yield return true;
        }

        //1.0 != asynce.progress 아닐 수도 있기에 1.0으로 고정
        Popup_scene_loding.transform.FindChild("Loding_Sprite").GetComponent<UISprite>().fillAmount = 1.0f;

    }