1. 실행 이미지

 

 

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

public class LoadingSlider : MonoBehaviour
{
    [SerializeField] Slider slider;
    void Start()
    {
        this.slider.value = 0;
        StartCoroutine("LoadingStart");
    }

    IEnumerator LoadingStart()
    {
        yield return new WaitForSeconds(2.0f);
        while (slider.value < slider.maxValue)
        {
            slider.value ++; 

            if(slider.value == slider.maxValue)
            {
                yield return new WaitForSeconds(2.0f);

                SceneManager.LoadScene("Stage1");
            }
            yield return new WaitForSeconds(1.0f);
        }

    }

 
}

2. LoadingSlider.cs

+ Recent posts