MEC.CoroutineHandle

A handle for a MEC coroutine. More...

Inherits System.IEquatable< CoroutineHandle >.

Public Member Functions

CoroutineHandle OnDestroy (IEnumerator< float > action, Segment segment=Segment.Update)
 This will execute the coroutine you pass in once the coroutine this handle is pointing to is ended. This works whether this coroutine gets to the end of its function, throws an exception, or is the target of a KillCoroutines command. NOTE: It is generally a bad idea to use this function on any coroutine that you would use a CancelWith command on, because that will typically lead to exceptions when the gameObject is destroyed. More...
 
CoroutineHandle OnDestroy (System.Action action, Segment segment=Segment.Update)
 This will execute the function you pass in once the coroutine this handle is pointing to is ended. This works whether this coroutine gets to the end of its function, throws an exception, or is the target of a KillCoroutines command. NOTE: It is generally a bad idea to use this function on any coroutine that you would use a CancelWith command on, because that will typically lead to exceptions when the gameObject is destroyed. More...
 

Properties

bool IsAliveAndPaused [get, set]
 Is true while the coroutine is paused. Setting this value will pause or resume the coroutine.
 
bool IsRunning [get, set]
 Is true until the coroutine function ends or is killed. Paused or waiting coroutines count as running. Setting this to false will kill the coroutine.
 
bool IsValid [get]
 Is true if this handle may have been a valid handle at some point. (i.e. is not an uninitialized handle, error handle, or a key to a coroutine lock)
 
int? Layer [get, set]
 Get or set the corrosponding coroutine's layer. Null removes the layer or represents no layer assigned.
 
Segment Segment [get, set]
 Get or set the coorsponding coroutine's segment.
 
string Tag [get, set]
 Get or set the corrosponding coroutine's tag. Null removes the tag or represents no tag assigned.
 

Detailed Description

A handle for a MEC coroutine.

Member Function Documentation

◆ OnDestroy() [1/2]

CoroutineHandle MEC.CoroutineHandle.OnDestroy ( IEnumerator< float >  action,
Segment  segment = Segment.Update 
)

This will execute the coroutine you pass in once the coroutine this handle is pointing to is ended. This works whether this coroutine gets to the end of its function, throws an exception, or is the target of a KillCoroutines command. NOTE: It is generally a bad idea to use this function on any coroutine that you would use a CancelWith command on, because that will typically lead to exceptions when the gameObject is destroyed.

Parameters
actionThe coroutine that you want to execute after this coroutine ends.
segmentThe timing segment that the OnDestroy coroutine should be executed in.
Returns

◆ OnDestroy() [2/2]

CoroutineHandle MEC.CoroutineHandle.OnDestroy ( System.Action  action,
Segment  segment = Segment.Update 
)

This will execute the function you pass in once the coroutine this handle is pointing to is ended. This works whether this coroutine gets to the end of its function, throws an exception, or is the target of a KillCoroutines command. NOTE: It is generally a bad idea to use this function on any coroutine that you would use a CancelWith command on, because that will typically lead to exceptions when the gameObject is destroyed.

Parameters
actionThe function that you want to execute after this coroutine ends.
segmentThe timing segment that the OnDestroy action should be executed in.
Returns