that coroutines make me sleepless ,need help
i have a list of points i want first coroutine to move a gameobject for every point in the list when finished
start other coroutine but backward of the list until i=0 ,and repeat ect. here is some script
`
void Start(){
StartCoroutine(forward());
}
IEnumerator forward(){
print("first");
for( int i=0;i<points.Count;i++)
{
transform.localPosition=points*;*
-
yield return new WaitForSeconds(1);*
-
}*
-
StartCoroutine(backward());*
-
}*
-
IEnumerator backward(){*
-
print("in 2");*
-
for( int i=points.Count;i>=0;i--)*
-
{*
_ transform.localPosition=points*;*_
* yield return new WaitForSeconds(0.1f);*
* }*
* print(“leave 2”);*
* StartCoroutine(forward());*
* }*
`
so the second repeat doesn’t start one after one but they run at the same time
thank you .