码迷,mamicode.com
首页 > 其他好文 > 详细

U3D中的协同等待函数

时间:2015-12-18 21:18:06      阅读:724      评论:0      收藏:0      [点我收藏+]

标签:

  WaitForSeconds.WaitForseconds等待函数;

  创建一个yield指令,来等待给定的秒数;

技术分享
 1 using UnityEngine;
 2 using System.Collections;
 3 
 4 public class example:MonoBehaviour
 5 {
 6     public IEnumerator Awake()
 7 {
 8   print(Time.time);
 9   yield return new WaitForSeconds(5);
10   print(Time.time);        
11 }  
12 }
WaitForSeconds.WaitForSeconds

  注:

  1、必须添加接口IEnumerator,

  2、等待函数只能写在接口内;

U3D中的协同等待函数

标签:

原文地址:http://www.cnblogs.com/YeYunRong/p/5058205.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!