文档下载 文档下载导航
设为首页 | 加入收藏
搜索 请输入内容:  
 导航当前位置: 文档下载 > 所有分类 > IT/计算机 > 计算机软件及应用 > Unity3D游戏开发之使用异步加载游戏场景
侵权投诉

Unity3D游戏开发之使用异步加载游戏场景

游戏异步加载,场景跳转必看。

1. using UnityEngine; 2. using System.Collections.Generic; 3.

4. public class UseWwwLoaderManager : MonoBehaviour

5. {

6. public UISlider progressBar;

7. public UILabel lblStatus;

8.

9. private string scenePath;

10.

11. void Awake()

12. {

13. this.scenePath = "doc.guandang.net; + Application.dataPath +

"/Assets/MainScene.unity3d";

14.

15. IList<WwwLoaderPath> pathList = new List<WwwLoaderPath> ();

16. pathList.Add (new WwwLoaderPath (this.scenePath, Random.Range (0, 100),

WwwLoaderTypeEnum.UNITY_3D));

17.

18. this.lblStatus.text = "场景加载中,请稍候。。。";

19.

20. WwwLoaderManager.instance.Loader (pathList, onLoaderProgress,

onLoaderComplete, "MainScene");

21. }

22.

23. private void onLoaderProgress(string path, float currentValue, float

totalValue)

24. {

25. this.progressBar.value = currentValue;

26. }

27.

28. private void onLoaderComplete()

29. {

30. this.lblStatus.text = "场景正在初始化,请等待。。。";

31. Application.LoadLevelAsync("MainScene");

32. }

33. }

运行,可以看到与上面同样的加载效果。

上一页第5页

你可能喜欢

热门文档

相关文档

站点地图 | 文档上传 | 侵权投诉 | 手机版
本站所有资源均来自互联网,本站只负责收集和整理,均不承担任何法律责任,如有侵权等其它行为请联系我们.
文档下载 Copyright 2013 doc.guandang.net All Rights Reserved.  -  email