同一个计时的代码,
using UnityEngine;
using System.Collections;
public class CountSeconds : MonoBehaviour
{
int seconds = 0;
float timer = 0;
// Use this for initialization
void Start()
{
}
// Update is called once per frame
void Update()
{
timer += Time.deltaTime;
if (timer >= 1)
{
seconds++;
Debug.Log(seconds + "has passed ");
timer = 0;
}
}
}
using UnityEngine;
using System.Collections;
public class CountSeconds : MonoBehaviour
{
// Use this for initialization
void Start()
{
StartCoroutine("CountSecondsCrountine");
}
// Update is called once per frame
void U