I’m trying to keep track of time within a loop in a coroutine. I’m doing massive operations with (e.g. instantiating tens of thousands of objects for a data visualization) that can take 10 or 20 seconds. What I’d like to do is check the elapsed time at regular intervals in the looping structure, and yield a frame when a max time has passed.
I’ve seen a couple solutions around here and in the Unity documentation:
My question is whether there is one of these that is going to be better / more reliable across a range of platforms (standalone, web player, mobile). The obvious choice would be the Unity function Time.realtimeSinceStartup, but I’ve read that this has issues on iPhone.
In a general sense, I’m curious: the way that Unity compiles to Mono .Net and then to whatever language/hardware (e.g. Objective-C for iPhone), do I need to be wary of making System calls or specific libraries within system (like System.Xml)? Am I going to run into compatibility issues on non-Windows systems?