Asynchronous function

Hi,

I have a very complex function, and I’d like to compute it in background.
I have try with yield and coroutine but nothing work ;(

function Laucher(){
  Debug.Log("Should be printed in one");
  ComplexeOne(new Array(1, 2));
  Debug.Log("Should be printed in three");
}
function ComplexeOne(args:Array){
  Debug.Log("Should be printed in two");
  yield;
  Debug.Log("Sould be printed in four");
  //My complexe and slow code
}

I have this try, but with the yield console only print :

The function isn’t called…
And without the yield juste 1 → 2 → 4 → 3, the standard behaviour.

I have try many things with StartCoroutine and Yield but didn’t succed.

Can someone help me?

I’m using JavaScript.

Thanks a lot

In the complex function, you need to yield repeatedly in a loop to make it run asynchronously.