C# Class Foundation.Tasks.UnityTask

A task encapsulates future work that may be waited on. - Support running actions in background threads - Supports running coroutines with return results - Use the WaitForRoutine method to wait for the task in a coroutine
Inheritance: UnityEngine.CustomYieldInstruction, IDisposable
ファイルを表示 Open project: NVentimiglia/Unity3d-Foundation Class Usage Examples

Public Properties

Property Type Description
DisableMultiThread bool
LogErrors bool
Strategy TaskStrategy

Protected Properties

Property Type Description
_action System.Action
_routine IEnumerator
_status TaskStatus

Public Methods

Method Description
AddContinue ( Delegate action ) : void
Complete ( Exception ex = null ) : void

Runs complete logic, for custom tasks

Delay ( int millisecondTimeout ) : System.Threading.Tasks.Task
Delay ( int millisecondTimeout ) : void
DeserializeResult ( string json ) : void

For HTTP

Dispose ( ) : void
Start ( ) : void

Executes the task

UnityTask ( System.Action action ) : System

Creates a new background task

UnityTask ( System.Action action, TaskStrategy mode ) : System

Creates a new Task

UnityTask ( Exception ex ) : System

Creates a new Task in a Faulted state

UnityTask ( IEnumerator action ) : System

Creates a new Coroutine Task

UnityTask ( TaskStrategy mode ) : System

Creates a new task

Protected Methods

Method Description
Execute ( ) : void
OnRoutineComplete ( ) : void
OnTaskComplete ( ) : void
RunAsCoroutine ( ) : void
RunOnBackgroundThread ( ) : void
RunOnCurrentThread ( ) : void
RunOnMainThread ( ) : void

Private Methods

Method Description
UnityTask ( ) : System

Method Details

AddContinue() public method

public AddContinue ( Delegate action ) : void
action System.Delegate
return void

Complete() public method

Runs complete logic, for custom tasks
public Complete ( Exception ex = null ) : void
ex System.Exception
return void

Delay() public static method

public static Delay ( int millisecondTimeout ) : System.Threading.Tasks.Task
millisecondTimeout int
return System.Threading.Tasks.Task

Delay() public static method

public static Delay ( int millisecondTimeout ) : void
millisecondTimeout int
return void

DeserializeResult() public method

For HTTP
public DeserializeResult ( string json ) : void
json string
return void

Dispose() public method

public Dispose ( ) : void
return void

Execute() protected method

protected Execute ( ) : void
return void

OnRoutineComplete() protected method

protected OnRoutineComplete ( ) : void
return void

OnTaskComplete() protected method

protected OnTaskComplete ( ) : void
return void

RunAsCoroutine() protected method

protected RunAsCoroutine ( ) : void
return void

RunOnBackgroundThread() protected method

protected RunOnBackgroundThread ( ) : void
return void

RunOnCurrentThread() protected method

protected RunOnCurrentThread ( ) : void
return void

RunOnMainThread() protected method

protected RunOnMainThread ( ) : void
return void

Start() public method

Executes the task
public Start ( ) : void
return void

UnityTask() public method

Creates a new background task
public UnityTask ( System.Action action ) : System
action System.Action
return System

UnityTask() public method

Creates a new Task
public UnityTask ( System.Action action, TaskStrategy mode ) : System
action System.Action
mode TaskStrategy
return System

UnityTask() public method

Creates a new Task in a Faulted state
public UnityTask ( Exception ex ) : System
ex System.Exception
return System

UnityTask() public method

Creates a new Coroutine Task
public UnityTask ( IEnumerator action ) : System
action IEnumerator
return System

UnityTask() public method

Creates a new task
public UnityTask ( TaskStrategy mode ) : System
mode TaskStrategy
return System

Property Details

DisableMultiThread public_oe static_oe property

Forces use of a single thread for debugging
public static bool DisableMultiThread
return bool

LogErrors public_oe static_oe property

Logs Exceptions
public static bool LogErrors
return bool

Strategy public_oe property

Run execution path
public TaskStrategy Strategy
return TaskStrategy

_action protected_oe property

protected Action,System _action
return System.Action

_routine protected_oe property

protected IEnumerator _routine
return IEnumerator

_status protected_oe property

protected TaskStatus _status
return TaskStatus