How could I make a coroutine wait until it finishes to run another coroutine?
What i want to do is scale a gameobject’s width first and then scale it’s height next.
But from what it seems, it scales width and height at the same time.
void Example(){
StartCoroutine (SmoothScale (gobject, new Vector3 (0.6f, 0, 0),7f));
StartCoroutine (SmoothScale (gobject, new Vector3 (0, 1f, 0),4f));
}
IEnumerator SmoothScale(GameObject source,Vector3 scaleSize, float scaleLimit){
float startTime = Time.time;
while (source.transform.localScale.x <scaleLimit) {
source.transform.localScale += scaleSize;
yield return null;
}
yield return new WaitForSeconds (1f);
}