Hi,
I am coding some "blinking" stuff, which I can find many threads here, but any refering to the efficiency of those methods. So the too main options are:
i) Use yield WaitForSeconds() ii) Use a code I found in this thread, checking if it has passed enough time in the Update() function
var rate = .5; // seconds
var lastCheck = 0.0;
Update(){
if ((Time.time - lastCheck) >= rate)
{
Do Something
lastCheck = Time.time;
}
}
Even I saw an infinite loop placed in the Start() function, which I don't know how effiencient is that.
So, my question is, what is more efficient?
Other question I want to ask is about the 'yield' instruction. If i call yield WaitForSeconds() the execution thread is paused, isn't it?
And to make all my picture about 'threads' and 'yields' clear, there is one thread (per script) executing its script, isn't it?
Thanks in advance