异步加载场景

 1    //动态加载的图片
    public Image LoadingImage;

    //动态加载的数字
    public Text processText;

    //动态加载的时间
    float timer;

    void Update()
    {
        if (timer <= 1)
        {
            timer += 0.01f;
            LoadingImage.GetComponent<Image>().fillAmount = timer;
            //Mathf.FloorToInt最大整数
            int temp = Mathf.FloorToInt(timer * 100);
            processText.GetComponent<Text>().text = temp + "%";
        }
        else
        {
            SceneManager.LoadScene("03LoadVideo");
        }
       
    }

 

posted on 2018-09-19 10:11  追求LPY  阅读(271)  评论(0编辑  收藏  举报