Whenever you call Timing.RunCoroutine(…) a CoroutineHandle object is returned. That object can be used to make one coroutine wait for another using “yield return Timing.WaitUntilDone(handle);”. However, in MEC Pro the CoroutineHandle can do more.
Using Tag or Layer you can set or retrieve the associated graffitti.
CoroutineHandle handle = Timing.RunCoroutine(_TestCoroutine()); string oldTag = handle.Tag; handle.Tag = "newTag"; if(handle.Layer == null) // No layer is assigned handle.Layer = gameObject.GetInstanceID();
Note: Layer is a nullable int (int?) so it may require casting into a regular int in your code, and you should check whether the value is null when you query either tags or layers (a null value means that there is no tag or layer assigned.)
Segment can retrieve or change the timing segment that the coroutine is running in.
handle.Segment = Segment.SlowUpdate;
IsRunning, IsPaused, and IsValid
IsRunning returns true until the coroutine terminates, and then it returns false. Paused and/or locked coroutines are considered to be running.
IsPaused returns true if the coroutine is paused or locked.
IsValid returns true if the coroutine handle has ever pointed to a valid coroutine (regardless of whether that coroutine is currently running).