You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: UnityMainThreadDispatcher.cs
+10-12Lines changed: 10 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -20,12 +20,12 @@ limitations under the License.
20
20
usingSystem;
21
21
22
22
/// <summary>
23
-
/// A thread-safe class which holds a queue with actions to execute on the next Update() method. It can be used to make calls to the main thread for
23
+
/// A thread-safe class which holds a queue with actions to execute on the next Update() method. It can be used to make calls to the main thread for
24
24
/// things such as UI Manipulation in Unity. It was developed for use in combination with the Firebase Unity plugin, which uses separate threads for event handling
/// <param name="action">IEnumerator function that will be executed from the main thread.</param>
42
42
publicvoidEnqueue(IEnumeratoraction){
43
43
lock(_executionQueue){
44
-
_executionQueue.Enqueue(()=>{
45
-
StartCoroutine(action);
44
+
_executionQueue.Enqueue(()=>{
45
+
StartCoroutine(action);
46
46
});
47
47
}
48
48
}
49
-
49
+
50
50
/// <summary>
51
51
/// Locks the queue and adds the Action to the queue
52
52
/// </summary>
@@ -67,27 +67,25 @@ IEnumerator ActionWrapper(Action a)
67
67
publicstaticboolExists(){
68
68
return_instance!=null;
69
69
}
70
-
70
+
71
71
publicstaticUnityMainThreadDispatcherInstance(){
72
72
if(!Exists()){
73
73
thrownewException("UnityMainThreadDispatcher could not find the UnityMainThreadDispatcher object. Please ensure you have added the MainThreadExecutor Prefab to your scene.");
0 commit comments