`
whuthj
  • 浏览: 70005 次
  • 性别: Icon_minigender_1
  • 来自: 武汉
社区版块
存档分类
最新评论

延时调用方法

 
阅读更多
using UnityEngine;
using System.Collections;
public class NewBehaviourScript : MonoBehaviour {
// Use this for initialization
void Start () {
   InvokeRepeating("LaunchProjectile", 1,5);//1秒后调用LaunchProjectile () 函数,之后每5秒调用一次
}
// Update is called once per frame
void Update () {
   if (Input.GetButton ("Fire")) {
    CancelInvoke();
   }
}
void LaunchProjectile () {
   print("hello");
}
}

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics