【unity3d study ---- 麦子学院】---------- unity3d Ngui 插件项目实战 ---------- Scene跳转

从 LogoPage 跳转到 HomePage

需要在file下build setting 添加这两个scene

 

使用协程实现间隔两秒后跳转scene

 

使用的unity引擎版本是5.4.1f

 

unity4.x版本 跳转界面应该是 Application.LoadLevel("HomePage");

 

 

 

脚本代码:

 1 using UnityEngine;
 2 using System.Collections;
 3 using UnityEngine.SceneManagement;
 4 
 5 public class AutoPage : MonoBehaviour {
 6 
 7     // Use this for initialization
 8     void Start () {
 9         StartCoroutine(WaitForSecondToScene(2.0f));
10     }
11     
12     // Update is called once per frame
13     void Update () {
14     
15     }
16 
17     /// <summary>
18     /// 协程等待的执行的语句
19     /// </summary>
20     /// <returns>The for second.</returns>
21     /// <param name="delyTime">Dely time.</param>
22     IEnumerator WaitForSecondToScene(float delyTime){
23         // 等待的时间
24         yield return new WaitForSeconds (delyTime);
25         // 等待之后执行的语句
26         SceneManager.LoadScene ("HomePage");
27     }
28 }

 

posted @ 2016-11-13 19:46  silent-bobo  阅读(378)  评论(0编辑  收藏  举报