running a while loop until coroutine finishes
I am using multiple nested coroutines with "yield return StartCoroutine()" to wait for the execution of nested coroutines and would need to run a while loop as the nested routine executes (this is for an AI system to check for enemies or other conditions while running a task).
I could come up with 2 solutions to this, both not very ideal or clean. These are:
1. Creating a boolean to track when the nested routine finishes and change "yield return StartCoroutine" to simply "StartCoroutine". This is problematic because of nested coroutines.
2. Creating a new coroutine that runs the loop and stopping it when the first routine finishes. This is a nicer option but still not usable in my case.
For an ideal solution i would like it to be able to detect when either of the coroutines finish and which one finished.