本文最后编辑于 前,其中的内容可能需要更新。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| using System.Collections; using System.Collections.Generic; using UnityEngine;
public class Ftime : MonoBehaviour {
private float ftime; public bool start;
void Update () { if(start){ ftime += Time.deltaTime; if(ftime >= 1f) { ftime = 0f; } } } }
|
注意,float有精度问题,因此不能用作严格控制间隔时间的场景