Yield function goes slow sometimes/differently?

im scripting thecnical animation that can be change for a couple of different things…exemple
this is a majic casting from the ground…

    var Time:float=0.01;
    var Scaling:float=0.1;
    var Scaling:float=0.1;

function Cast(){
    for(var i=0; i<Multiplie;i++){ 
    transform.localScale.y+=Scaling;
    transform.localPosition.y+=Pos;
    yield WaitForSeconds(Time*Time.deltaTime);
    }
    if(Back)
    {
    yield WaitForSeconds(BackTime);
    for(var iy=0; iy<Multiplie;iy++)
    {
    transform.localScale.y-=Scaling;
    transform.localPosition.y-=Pos;
    yield WaitForSeconds(Time*Time.deltaTime);
    }
    }
}

the things is that im changing the vars depend of the majic that is casted…and i have a lot…so in my first computer yield run faster than my other one, when i play it on lower graphics and resolution it runing more faster again…when i have a lot of particles(particle emitter mostly)it runing slower but, when i use a mathf.lerp for some animation or even a simple rotation in the update or late update funtion…no matter what happen it runing at the same times and if i have a million of particle exemple…it will do the same but just lagging and skipping some frame around but the yield keep runing out slowly? i cant realy transfert my other animation in the update cuz i cant hold it and its so complicated…is there a way of fixing this?

Yield fires on the next frame after the time has past, so can’t count small numbers. Exs: yielding 0.00001, waits one frame. Yielding 0.0001 tens times in a row will skip 10 frames.

If you have to do delicate timing, maybe pick the final time and yield frames until then:

while(Time.time<doneTime) {
  do my stuff based on Time.deltaTime
  yield return null; // wait one frame
}
snap to final value

If you use “yield WaitForSeconds (Time.deltaTime)” then naturally a faster computer will wait for less time than a slower one, since less time has passed since the last frame. Only use absolute time values in WaitForSeconds, never anything multiplied by deltaTime. WaitForSeconds is already inherently framerate-independent; using Time.deltaTime makes it framerate-dependent.