简单计时器

Unity引擎 · 04-04 · 123 人浏览

public float cd = 3f; //间隔时间
public float timer = 0; //计时器

// Update is called once per frame
void Update()
{

if (Time.time-timer>cd)
{
    print("3秒执行一次");
    timer = Time.time;
}

}

Theme Jasmine by Kent Liao