using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class timeX : MonoBehaviour {
//计时器
float time = 5;
//记录次数
int i = 0;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
time += Time.deltaTime;
if (time > 5)
{
time = 0;
i++;
Debug.Log("每五秒循环一次,第" + i + "次");
}
}
}
面向组件编程之Unity 9.计时器 关键字:Time,Time.deltatime
最新推荐文章于 2022-09-17 21:43:13 发布