Can anyone help, I’m a little confused over co-routines.
If I set some going in a behaviour Start() call line this:-
void Start ()
{
StartCoroutine(BuildHeightMaps_01());
StartCoroutine(BuildHeightMaps_02());
}
IEnumerator BuildHeightMaps_01()
{
Debug.Log("Start Height maps 01: " + Time.realtimeSinceStartup.ToString());
for (int i = 0; i < 500000; i++)
{
}
Debug.Log("End Height maps 01: " + Time.realtimeSinceStartup.ToString());
yield return null;
}
IEnumerator BuildHeightMaps_02()
{
Debug.Log("Start Height maps 02: " + Time.realtimeSinceStartup.ToString());
for (int i = 0; i < 5000000; i++)
{
}
Debug.Log("End Height maps 02: " + Time.realtimeSinceStartup.ToString());
yield return null;
}
}
I get a slow concurrent feedback, like this.
Start Height maps 01: 0.02582638
End Height maps 01: 0.03087785
Start Height maps 02: 0.03390504
End Height maps 02: 0.04367269
I thought they were meant to be using threads?
Do I have to call them when the frames are starting, how do I get these in parallel?
Thanks.
Dave.