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

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

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

4. public class UseWww : MonoBehaviour

5. {

6. public UISlider progressBar;

7. public UILabel lblStatus;

8.

9. private WWW www;

10. private string scenePath;

11.

12. void Awake()

13. {

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

"/Assets/MainScene.unity3d";

15. // 开始加载场景

16. this.StartCoroutine (this.BeginLoader ());

17. }

18.

19. void Update()

20. {

21. if (this.www != null && this.progressBar != null && !this.doc.guandang.net)

22. {

23. // 更新进度

24. this.progressBar.value = this.doc.guandang.net;

25. }

26. }

27.

28. private IEnumerator BeginLoader()

29. {

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

31. // 加载场景使用 doc.guandang.net,函数,这样加载完成才能使用

Application.LoadLevel 或者 Application.LoadLevelAsync

32. this.www = doc.guandang.net (scenePath, Random.Range(0, 100));

33. yield return this.www;

34.

35. if(!string.IsNullOrEmpty(this.doc.guandang.net))

36. {

37. this.lblStatus.text = "场景加载出错!";

38. }

39.

40. if (this.doc.guandang.net)

41. {

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

43. Application.LoadLevelAsync("MainScene");

44. }

45. }

46. }

上一页第2页

你可能喜欢

热门文档

相关文档

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