I’m using WaitForSeconds to pause during a scripted animation. I’m finding that it is around .015 seconds slow. Is this really the accuracy of WaitForSeconds?
For example, this code consistently reports being off by .015 on my system.
using UnityEngine;
using System.Collections;
public class TestWaitForSeconds : MonoBehaviour {
private float lastTick;
void Start () {
StartCoroutine(Test());
}
private IEnumerator Test() {
while(true) {
lastTick = Time.time;
yield return new WaitForSeconds(.1f);
Debug.Log("Off by: " + Mathf.Abs((Time.time - lastTick) - .1f));
}
}
}