unity3d 延迟运行脚本语句
2024-08-31 12:42:11
在Unity3D中。有yield语句它负责延迟操作,yield return WaitForSeconds(3.0); //等待 3 秒
查看unity3d脚本手冊,使用方法须要在对应的格式。
以下代码含义就是,载入图片显示等待6秒后进入场景level1中。
using UnityEngine;
using System.Collections; public class init : MonoBehaviour { // Use this for initialization
public Texture img;
private bool bl = false;
public float waitTime ;
void Start () {
StartCoroutine( wait(6.0f) ); } // Update is called once per frame
void Update () {
if (bl)
Application.LoadLevel(1); } void OnGUI()
{
GUI.DrawTexture(new Rect(0,0,1024,768),img);
} IEnumerator wait(float time)
{
yield return new WaitForSeconds(waitTime);
bl = true;
}
}
最新文章
- iOS开发之再探多线程编程:Grand Central Dispatch详解
- Hadoop: MapReduce2的几个基本示例
- How to AC it
- A Guide to Creating a Quality Project Schedule
- Sqli-labs less 32
- Linux下用来获取各种系统信息的C++类
- CKEditor&ckfindtor
- 【转】commons-fileupload-1.2.1.jar和commons-io-1.3.2.jar实现文件上传
- ACM/ICPM2014鞍山现场赛D Galaxy (HDU 5073)
- jQuery Ajax: $.post请求示例
- 打开Openstack dashboard出现Internal Server Error
- fgets的用法
- BZOJ_1031_[JSOI2007]字符加密Cipher_后缀数组
- 关于MDN,HTML入门来自MDN文档
- mac os安装多个版本的chrome
- mybatis foreach 遍历list中的坑
- 洛谷 P2058 海港 解题报告
- Ubuntu下Apache虚拟主机+反向代理
- Visual Studio Code用户设置文件
- C语言程序设计I—第九周教学
热门文章
- An internal error occurred during: &;quot;Building workspace&;quot;. java.lang.StackOverflowError
- Ural 1152 False Mirrors(状压DP)
- Laravel异常处理
- vue中使用UEditor编辑器 -- 2
- 手把手教你写带登录的NodeJS爬虫+数据展示
- learn cmake
- AARRR:互联网创业者一定要掌握的指标
- python3 pymysql学习笔记
- CDR 2017版本LiveSketch工具是什么,怎么用?
- 数据库常用sql语句积累