Class SyncContext
Specialized class that allows call a method on the main thread. This is useful when you have to call a Unity API from a thread that is not the main thread.
Inherited Members
Namespace: Doozy.Runtime.Common
Assembly: cs.temp.dll.dll
Syntax
public class SyncContext : SingletonBehaviour<SyncContext>
Properties
isOnUnityThread
Returns TRUE if the current thread is the Unity main thread
Declaration
public static bool isOnUnityThread { get; }
Property Value
Type | Description |
---|---|
Boolean |
runInUpdate
Queue of tasks to be executed on the main thread
Declaration
public static Queue<Action> runInUpdate { get; }
Property Value
Type | Description |
---|---|
Queue<Action> |
unitySynchronizationContext
Synchronization context for the main thread
Declaration
public static SynchronizationContext unitySynchronizationContext { get; }
Property Value
Type | Description |
---|---|
SynchronizationContext |
unityTaskScheduler
Task scheduler that runs tasks on the main thread
Declaration
public static TaskScheduler unityTaskScheduler { get; }
Property Value
Type | Description |
---|---|
TaskScheduler |
unityThread
Unity's main thread
Declaration
public static int unityThread { get; }
Property Value
Type | Description |
---|---|
Int32 |
Methods
Awake()
Declaration
protected override void Awake()
Overrides
Doozy.Runtime.Common.SingletonBehaviour<Doozy.Runtime.Common.SyncContext>.Awake()
Initialize()
Declaration
public static void Initialize()
RunOnUnityThread(Action)
Runs the given action on the main thread
Declaration
public static void RunOnUnityThread(Action action)
Parameters
Type | Name | Description |
---|---|---|
Action | action | Action to run on the main thread |