File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
UnityProject/Assets/Plugins/AsyncAwaitUtil/Source/Internal Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -10,9 +10,37 @@ namespace UnityAsyncAwaitUtil
10
10
{
11
11
public static class SyncContextUtil
12
12
{
13
+ #if UNITY_EDITOR
14
+ private static System . Reflection . MethodInfo executionMethod ;
15
+
16
+ /// <summary>
17
+ /// HACK: makes Unity Editor execute continuations in edit mode.
18
+ /// </summary>
19
+ private static void ExecuteContinuations ( )
20
+ {
21
+ if ( UnityEditor . EditorApplication . isPlayingOrWillChangePlaymode )
22
+ {
23
+ return ;
24
+ }
25
+
26
+ var context = SynchronizationContext . Current ;
27
+
28
+ if ( executionMethod == null )
29
+ {
30
+ executionMethod = context . GetType ( ) . GetMethod ( "Exec" , System . Reflection . BindingFlags . NonPublic | System . Reflection . BindingFlags . Instance ) ;
31
+ }
32
+
33
+ executionMethod ? . Invoke ( context , null ) ;
34
+ }
35
+
36
+ [ UnityEditor . InitializeOnLoadMethod ]
37
+ #endif
13
38
[ RuntimeInitializeOnLoadMethod ( RuntimeInitializeLoadType . BeforeSceneLoad ) ]
14
39
static void Install ( )
15
40
{
41
+ #if UNITY_EDITOR
42
+ UnityEditor . EditorApplication . update += ExecuteContinuations ;
43
+ #endif
16
44
UnitySynchronizationContext = SynchronizationContext . Current ;
17
45
UnityThreadId = Thread . CurrentThread . ManagedThreadId ;
18
46
}
You can’t perform that action at this time.
0 commit comments