I’ve used timer.performWithDelay() extensively in my games, but I realized today that it is not invoking the listener at the specified interval.
Repro:
- Call timer.performWithDelay() and specify any interval from 10 to 100 with infinite iterations.
- The listener shall increment some counter variable by the interval passed to timer.performWithDelay() which tracks the elapsed time since the call.
- The expected behavior is to observe the counter variable increasing in real-time seconds equivalent to a stop watch.
- Observe that the counter variable is increasing slower than real-time. That is, the counter variable reaches 10 seconds roughly 3-5 seconds after 10 real-time seconds.
Is this a known gotcha with this API call? Shouldn’t the listener be called at the specified interval and no slower (10 - 100 ms seems reasonable)?