延时调用方法
using UnityEngine;using System.Collections;public class NewBehaviourScript : MonoBehaviour {// Use this for initializationvoid Start () { InvokeRepeating("LaunchProjectile", 1,5);//1秒后调用LaunchProjectile () 函数,之后每5秒调用一次}// Update is called once per framevoid Update () { if (Input.GetButton ("Fire")) { CancelInvoke(); }}void LaunchProjectile () { print("hello");}}
?