Reliable Editor Time

Hello,

I’m using, currently, EditorApplication.update to create an update loop within an editor script. However it doesn’t seem reliable, and even though it says it updates at (approx.) 100 times a second, if I wait 300 updates, I end up waiting about 4 1/2 seconds, which is no good.

Does anyone know other timing methods available to editor scripts, to get more reliable results?

Thanks.

You shouldn’t rely on the update delegate for timing. Use it as you would the MonoBehaviour.Update message: It’s a regular thing called at some interval and do your time checks within that - not assuming a fixed invocation rate.

Notice that the Time class is not running in editor mode, so you would need to use something from the .net library like storing DateTime.Now in a DateTime variable at the start of your Update method and then work from that data throughout (comparing to target times, calculating deltas etc).

You are a sexy beast AngryAnt, thanks :>