您当前的位置: 首页 >  unity

程序员正茂

暂无认证

  • 3浏览

    0关注

    283博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

unity加载初始场景界面显示进度

程序员正茂 发布时间:2019-12-24 19:04:25 ,浏览量:3

//private bool loadScene = false;
    public Text loadingText;
    public Slider sliderBar;
    // Start is called before the first frame update
    void Start()
    {
        StartCoroutine(LoadNewScene());
    }

    IEnumerator LoadNewScene()
    {
        AsyncOperation async = SceneManager.LoadSceneAsync("SampleScene");
        while(!async.isDone)
        {
            float progress = Mathf.Clamp01(async.progress / 0.9f);
            sliderBar.value = progress;
            loadingText.text = progress * 100.0f + "%";
            yield return null;
        }
    }

 

关注
打赏
1660743125
查看更多评论
立即登录/注册

微信扫码登录

0.0416s