Class Runnable
Helper class for running co-routines without having to inherit from MonoBehavior.
Inheritance
MonoBehaviour
Runnable
Namespace:Mapbox.Unity.Utilities
Assembly:cs.temp.dll.dll
Syntax
public class Runnable : MonoBehaviour
Properties
Instance
Returns the Runnable instance.
Declaration
public static Runnable Instance { get; }
Property Value
Type | Description |
---|---|
Runnable |
Methods
IsRunning(Int32)
Check if a routine is still running.
Declaration
public static bool IsRunning(int id)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | The ID returned by Run(). |
Returns
Type | Description |
---|---|
System.Boolean | Returns true if the routine is still active. |
Run(IEnumerator)
Start a co-routine function.
Declaration
public static int Run(IEnumerator routine)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.IEnumerator | routine | The IEnumerator returns by the co-routine function the user is invoking. |
Returns
Type | Description |
---|---|
System.Int32 | Returns a ID that can be passed into Stop() to halt the co-routine. |
Stop(Int32)
Stops a active co-routine.
Declaration
public static void Stop(int ID)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | ID | THe ID of the co-routine to stop. |
UpdateRoutines()
THis can be called by the user to force all co-routines to get a time slice, this is usually invoked from an EditorApplication.Update callback so we can use runnable in Editor mode.
Declaration
public void UpdateRoutines()