IEnumerator SendSpriteForward(int no, Coroutine n,int prevhighestorderInlayer)
{
while (true) {
StopCoroutine (n);
for (int i = 0; i < gameObjectsContainer.transform.childCount; i++) {
gameObjectsContainer.GetChild (i).transform.GetChild (no).GetComponent ().sortingOrder = gameObjectsContainer.GetChild (i).transform.GetChild (prevhighestorderInlayer).GetComponent ().sortingOrder + 1;
}
n = StartCoroutine (GenericCoroutine (no, 0));
yield return new WaitForSeconds (6);
}
}
I need to call this coroutine in start method at different times .
In start Method i want to call them as such
StartCoroutine(SendSpriteForward(5,one,0)); //start this call at 6 second
StartCoroutine(SendSpriteForward(4,two,5)); // this at 7
StartCoroutine(SendSpriteForward(3,three,4));//8
StartCoroutine(SendSpriteForward(2,four,3));//9
StartCoroutine(SendSpriteForward(1,five,2));//10
StartCoroutine(SendSpriteForward(0,six,1));//11
and so .
The Repeating functionality has been attained but the start time i need to.
Thank you.