From ecf6c1fba583c621e3f2d4d38b0129adc67e1a8f Mon Sep 17 00:00:00 2001 From: Antonio Date: Mon, 9 Sep 2019 13:07:56 +0200 Subject: [PATCH 1/3] Fixed edit mode, clear continuations and runners on run mode change, edit mode unit tests --- Assets/Tests/Editor.meta | 8 + Assets/Tests/Editor/AsyncTestEditor.cs | 405 +++++++++++ Assets/Tests/Editor/AsyncTestEditor.cs.meta | 11 + Assets/Tests/Editor/RunTestEditor.cs | 96 +++ Assets/Tests/Editor/RunTestEditor.cs.meta | 11 + .../Editor/UniRx.Async.Tests.Editor.asmdef | 23 + .../UniRx.Async.Tests.Editor.asmdef.meta | 7 + Assets/Tests/Editor/WhenAnyTestEditor.cs | 44 ++ Assets/Tests/Editor/WhenAnyTestEditor.cs.meta | 11 + .../UniRx.Async/Internal/ContinuationQueue.cs | 9 + .../UniRx.Async/Internal/PlayerLoopRunner.cs | 11 + Assets/UniRx.Async/PlayerLoopHelper.cs | 63 +- UniRx.Async.Tests.Editor.csproj | 648 ++++++++++++++++++ 13 files changed, 1326 insertions(+), 21 deletions(-) create mode 100644 Assets/Tests/Editor.meta create mode 100644 Assets/Tests/Editor/AsyncTestEditor.cs create mode 100644 Assets/Tests/Editor/AsyncTestEditor.cs.meta create mode 100644 Assets/Tests/Editor/RunTestEditor.cs create mode 100644 Assets/Tests/Editor/RunTestEditor.cs.meta create mode 100644 Assets/Tests/Editor/UniRx.Async.Tests.Editor.asmdef create mode 100644 Assets/Tests/Editor/UniRx.Async.Tests.Editor.asmdef.meta create mode 100644 Assets/Tests/Editor/WhenAnyTestEditor.cs create mode 100644 Assets/Tests/Editor/WhenAnyTestEditor.cs.meta create mode 100644 UniRx.Async.Tests.Editor.csproj diff --git a/Assets/Tests/Editor.meta b/Assets/Tests/Editor.meta new file mode 100644 index 0000000..24a4fc4 --- /dev/null +++ b/Assets/Tests/Editor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 649f696fcc0c3104a8de82a2550d248c +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Tests/Editor/AsyncTestEditor.cs b/Assets/Tests/Editor/AsyncTestEditor.cs new file mode 100644 index 0000000..a86271f --- /dev/null +++ b/Assets/Tests/Editor/AsyncTestEditor.cs @@ -0,0 +1,405 @@ +#if !(UNITY_4_5 || UNITY_4_6 || UNITY_4_7 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2) +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member + +using UnityEngine; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using UnityEngine.UI; +using UnityEngine.Scripting; +using UniRx; +using UniRx.Async; +using UnityEngine.SceneManagement; +#if CSHARP_7_OR_LATER || (UNITY_2018_3_OR_NEWER && (NET_STANDARD_2_0 || NET_4_6)) +using System.Threading.Tasks; +#endif +using UnityEngine.Networking; + +#if !UNITY_2019_3_OR_NEWER +using UnityEngine.Experimental.LowLevel; +#else +using UnityEngine.LowLevel; +#endif + +#if !UNITY_WSA +using Unity.Jobs; +#endif +using Unity.Collections; +using System.Threading; +using NUnit.Framework; +using UnityEngine.TestTools; +using FluentAssertions; + +namespace UniRx.AsyncTests +{ + public class AsyncTest + { +#if CSHARP_7_OR_LATER || (UNITY_2018_3_OR_NEWER && (NET_STANDARD_2_0 || NET_4_6)) +#if !UNITY_WSA + + public struct MyJob : IJob + { + public int loopCount; + public NativeArray inOut; + public int result; + + public void Execute() + { + result = 0; + for (int i = 0; i < loopCount; i++) + { + result++; + } + inOut[0] = result; + } + } + + [UnityTest] + public IEnumerator DelayAnd() => UniTask.ToCoroutine(async () => + { + await UniTask.Yield(PlayerLoopTiming.PostLateUpdate); + + var time = Time.realtimeSinceStartup; + + Time.timeScale = 0.5f; + try + { + await UniTask.Delay(TimeSpan.FromSeconds(3)); + + var elapsed = Time.realtimeSinceStartup - time; + ((int)Math.Round(TimeSpan.FromSeconds(elapsed).TotalSeconds, MidpointRounding.ToEven)).Should().Be(6); + } + finally + { + Time.timeScale = 1.0f; + } + }); + + [UnityTest] + public IEnumerator DelayIgnore() => UniTask.ToCoroutine(async () => + { + var time = Time.realtimeSinceStartup; + + Time.timeScale = 0.5f; + try + { + await UniTask.Delay(TimeSpan.FromSeconds(3), ignoreTimeScale: true); + + var elapsed = Time.realtimeSinceStartup - time; + ((int)Math.Round(TimeSpan.FromSeconds(elapsed).TotalSeconds, MidpointRounding.ToEven)).Should().Be(3); + } + finally + { + Time.timeScale = 1.0f; + } + }); + + [UnityTest] + public IEnumerator WhenAll() => UniTask.ToCoroutine(async () => + { + var a = UniTask.FromResult(999); + var b = UniTask.Yield(PlayerLoopTiming.Update, CancellationToken.None).AsAsyncUnitUniTask(); + var c = UniTask.DelayFrame(99); + + var (a2, b2, c2) = await UniTask.WhenAll(a, b, c); + a2.Should().Be(999); + b2.Should().Be(AsyncUnit.Default); + c2.Should().Be(99); + }); + + [UnityTest] + public IEnumerator WhenAny() => UniTask.ToCoroutine(async () => + { + var a = UniTask.FromResult(999); + var b = UniTask.Yield(PlayerLoopTiming.Update, CancellationToken.None).AsAsyncUnitUniTask(); + var c = UniTask.DelayFrame(99); + + var (win, a2, b2, c2) = await UniTask.WhenAny(a, b, c); + win.Should().Be(0); + a2.hasResult.Should().Be(true); + a2.result0.Should().Be(999); + b2.hasResult.Should().Be(false); + c2.hasResult.Should().Be(false); + }); + + [UnityTest] + public IEnumerator BothEnumeratorCheck() => UniTask.ToCoroutine(async () => + { + await ToaruCoroutineEnumerator(); // wait 5 frame:) + await ToaruCoroutineEnumerator().ConfigureAwait(PlayerLoopTiming.PostLateUpdate); + }); + + [UnityTest] + public IEnumerator JobSystem() => UniTask.ToCoroutine(async () => + { + var job = new MyJob() { loopCount = 999, inOut = new NativeArray(1, Allocator.TempJob) }; + JobHandle.ScheduleBatchedJobs(); + await job.Schedule(); + job.inOut[0].Should().Be(999); + job.inOut.Dispose(); + }); + + class MyMyClass + { + public int MyProperty { get; set; } + } + + [UnityTest] + public IEnumerator WaitUntil() => UniTask.ToCoroutine(async () => + { + bool t = false; + + await UniTask.Yield(PlayerLoopTiming.PostLateUpdate); + + UniTask.DelayFrame(10,PlayerLoopTiming.PostLateUpdate).ContinueWith(_ => t = true).Forget(); + + var startFrame = Time.frameCount; + await UniTask.WaitUntil(() => t, PlayerLoopTiming.EarlyUpdate); + + var diff = Time.frameCount - startFrame; + diff.Should().Be(11); + }); + + [UnityTest] + public IEnumerator WaitWhile() => UniTask.ToCoroutine(async () => + { + bool t = true; + + UniTask.DelayFrame(10, PlayerLoopTiming.PostLateUpdate).ContinueWith(_ => t = false).Forget(); + + var startFrame = Time.frameCount; + await UniTask.WaitWhile(() => t, PlayerLoopTiming.EarlyUpdate); + + var diff = Time.frameCount - startFrame; + diff.Should().Be(11); + }); + + [UnityTest] + public IEnumerator WaitUntilValueChanged() => UniTask.ToCoroutine(async () => + { + var v = new MyMyClass { MyProperty = 99 }; + + UniTask.DelayFrame(10, PlayerLoopTiming.PostLateUpdate).ContinueWith(_ => v.MyProperty = 1000).Forget(); + + var startFrame = Time.frameCount; + await UniTask.WaitUntilValueChanged(v, x => x.MyProperty, PlayerLoopTiming.EarlyUpdate); + + var diff = Time.frameCount - startFrame; + diff.Should().Be(11); + }); + + [UnityTest] + public IEnumerator SwitchTo() => UniTask.ToCoroutine(async () => + { + await UniTask.Yield(); + + var currentThreadId = Thread.CurrentThread.ManagedThreadId; + + + + await UniTask.SwitchToThreadPool(); + //await UniTask.SwitchToThreadPool(); + //await UniTask.SwitchToThreadPool(); + + + + + + + var switchedThreadId = Thread.CurrentThread.ManagedThreadId; + + + + currentThreadId.Should().NotBe(switchedThreadId); + + + await UniTask.Yield(); + + var switchedThreadId2 = Thread.CurrentThread.ManagedThreadId; + + currentThreadId.Should().Be(switchedThreadId2); + }); + + //[UnityTest] + //public IEnumerator ObservableConversion() => UniTask.ToCoroutine(async () => + //{ + // var v = await Observable.Range(1, 10).ToUniTask(); + // v.Is(10); + + // v = await Observable.Range(1, 10).ToUniTask(useFirstValue: true); + // v.Is(1); + + // v = await UniTask.DelayFrame(10).ToObservable().ToTask(); + // v.Is(10); + + // v = await UniTask.FromResult(99).ToObservable(); + // v.Is(99); + //}); + + //[UnityTest] + //public IEnumerator AwaitableReactiveProperty() => UniTask.ToCoroutine(async () => + //{ + // var rp1 = new ReactiveProperty(99); + + // UniTask.DelayFrame(100).ContinueWith(x => rp1.Value = x).Forget(); + + // await rp1; + + // rp1.Value.Is(100); + + // // var delay2 = UniTask.DelayFrame(10); + // // var (a, b ) = await UniTask.WhenAll(rp1.WaitUntilValueChangedAsync(), delay2); + + //}); + + //[UnityTest] + //public IEnumerator AwaitableReactiveCommand() => UniTask.ToCoroutine(async () => + //{ + // var rc = new ReactiveCommand(); + + // UniTask.DelayFrame(100).ContinueWith(x => rc.Execute(x)).Forget(); + + // var v = await rc; + + // v.Is(100); + //}); + + [UnityTest] + public IEnumerator ExceptionlessCancellation() => UniTask.ToCoroutine(async () => + { + var cts = new CancellationTokenSource(); + + UniTask.DelayFrame(10).ContinueWith(_ => cts.Cancel()).Forget(); + + var first = Time.frameCount; + var (canceled, value) = await UniTask.DelayFrame(100, cancellationToken: cts.Token).SuppressCancellationThrow(); + + (Time.frameCount - first).Should().Be(11); // 10 frame canceled + canceled.Should().Be(true); + }); + + [UnityTest] + public IEnumerator ExceptionCancellation() => UniTask.ToCoroutine(async () => + { + var cts = new CancellationTokenSource(); + + UniTask.DelayFrame(10).ContinueWith(_ => cts.Cancel()).Forget(); + + bool occur = false; + try + { + var value = await UniTask.DelayFrame(100, cancellationToken: cts.Token); + } + catch (OperationCanceledException) + { + occur = true; + } + occur.Should().BeTrue(); + }); + + IEnumerator ToaruCoroutineEnumerator() + { + yield return null; + yield return null; + yield return null; + yield return null; + yield return null; + } + + [UnityTest] + public IEnumerator ExceptionUnobserved1() => UniTask.ToCoroutine(async () => + { + bool calledEx = false; + Action action = exx => + { + calledEx = true; + exx.Message.Should().Be("MyException"); + }; + + UniTaskScheduler.UnobservedTaskException += action; + + var ex = InException1(); + ex = default(UniTask); + + await UniTask.DelayFrame(3); + + GC.Collect(); + GC.WaitForPendingFinalizers(); + GC.Collect(); + + await UniTask.DelayFrame(1); + + calledEx.Should().BeTrue(); + + UniTaskScheduler.UnobservedTaskException -= action; + }); + + [UnityTest] + public IEnumerator ExceptionUnobserved2() => UniTask.ToCoroutine(async () => + { + bool calledEx = false; + Action action = exx => + { + calledEx = true; + exx.Message.Should().Be("MyException"); + }; + + UniTaskScheduler.UnobservedTaskException += action; + + var ex = InException2(); + ex = default(UniTask); + + await UniTask.DelayFrame(3); + + GC.Collect(); + GC.WaitForPendingFinalizers(); + GC.Collect(); + + await UniTask.DelayFrame(1); + + calledEx.Should().BeTrue(); + + UniTaskScheduler.UnobservedTaskException -= action; + }); + + async UniTask InException1() + { + await UniTask.Yield(); + throw new Exception("MyException"); + } + + async UniTask InException2() + { + await UniTask.Yield(); + throw new Exception("MyException"); + } + + [UnityTest] + public IEnumerator NestedEnumerator() => UniTask.ToCoroutine(async () => + { + var time = Time.realtimeSinceStartup; + + await ParentCoroutineEnumerator(); + + var elapsed = Time.realtimeSinceStartup - time; + ((int)Math.Round(TimeSpan.FromSeconds(elapsed).TotalSeconds, MidpointRounding.ToEven)).Should().Be(3); + }); + + IEnumerator ParentCoroutineEnumerator() + { + yield return ChildCoroutineEnumerator(); + } + + IEnumerator ChildCoroutineEnumerator() + { + yield return new WaitForSeconds(3); + } + +#endif +#endif + } +} + +#endif \ No newline at end of file diff --git a/Assets/Tests/Editor/AsyncTestEditor.cs.meta b/Assets/Tests/Editor/AsyncTestEditor.cs.meta new file mode 100644 index 0000000..fce99d3 --- /dev/null +++ b/Assets/Tests/Editor/AsyncTestEditor.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 851899ba3337ac24a8331cb18fabe771 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Tests/Editor/RunTestEditor.cs b/Assets/Tests/Editor/RunTestEditor.cs new file mode 100644 index 0000000..b6caa46 --- /dev/null +++ b/Assets/Tests/Editor/RunTestEditor.cs @@ -0,0 +1,96 @@ +#if !(UNITY_4_5 || UNITY_4_6 || UNITY_4_7 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2) +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member + +using UnityEngine; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using UnityEngine.UI; +using UnityEngine.Scripting; +using UniRx; +using UniRx.Async; +using UnityEngine.SceneManagement; +#if CSHARP_7_OR_LATER || (UNITY_2018_3_OR_NEWER && (NET_STANDARD_2_0 || NET_4_6)) +using System.Threading.Tasks; +#endif +using UnityEngine.Networking; + +#if !UNITY_2019_3_OR_NEWER +using UnityEngine.Experimental.LowLevel; +#else +using UnityEngine.LowLevel; +#endif + +#if !UNITY_WSA +using Unity.Jobs; +#endif +using Unity.Collections; +using System.Threading; +using NUnit.Framework; +using UnityEngine.TestTools; +using FluentAssertions; + +namespace UniRx.AsyncTests +{ + public class RunTest + { +#if CSHARP_7_OR_LATER || (UNITY_2018_3_OR_NEWER && (NET_STANDARD_2_0 || NET_4_6)) +#if !UNITY_WSA + + //[UnityTest] + //public IEnumerator RunThread() => UniTask.ToCoroutine(async () => + //{ + // var main = Thread.CurrentThread.ManagedThreadId; + // var v = await UniTask.Run(() => { return System.Threading.Thread.CurrentThread.ManagedThreadId; }, false); + // UnityEngine.Debug.Log("Ret Value is:" + v); + // UnityEngine.Debug.Log("Run Here and id:" + System.Threading.Thread.CurrentThread.ManagedThreadId); + // //v.Should().Be(3); + // main.Should().NotBe(Thread.CurrentThread.ManagedThreadId); + //}); + + [UnityTest] + public IEnumerator RunThreadConfigure() => UniTask.ToCoroutine(async () => + { + var main = Thread.CurrentThread.ManagedThreadId; + var v = await UniTask.Run(() => 3, true); + v.Should().Be(3); + main.Should().Be(Thread.CurrentThread.ManagedThreadId); + }); + + //[UnityTest] + //public IEnumerator RunThreadException() => UniTask.ToCoroutine(async () => + //{ + // var main = Thread.CurrentThread.ManagedThreadId; + // try + // { + // await UniTask.Run(() => throw new Exception(), false); + // } + // catch + // { + // main.Should().NotBe(Thread.CurrentThread.ManagedThreadId); + // } + //}); + + [UnityTest] + public IEnumerator RunThreadExceptionConfigure() => UniTask.ToCoroutine(async () => + { + var main = Thread.CurrentThread.ManagedThreadId; + try + { + await UniTask.Run(() => throw new Exception(), true); + } + catch + { + main.Should().Be(Thread.CurrentThread.ManagedThreadId); + } + }); + + +#endif +#endif + } +} + +#endif \ No newline at end of file diff --git a/Assets/Tests/Editor/RunTestEditor.cs.meta b/Assets/Tests/Editor/RunTestEditor.cs.meta new file mode 100644 index 0000000..0d424ae --- /dev/null +++ b/Assets/Tests/Editor/RunTestEditor.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 76d078e5d960ac2429ce67a930c29ade +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Tests/Editor/UniRx.Async.Tests.Editor.asmdef b/Assets/Tests/Editor/UniRx.Async.Tests.Editor.asmdef new file mode 100644 index 0000000..6c6e588 --- /dev/null +++ b/Assets/Tests/Editor/UniRx.Async.Tests.Editor.asmdef @@ -0,0 +1,23 @@ +{ + "name": "UniRx.Async.Tests.Editor", + "references": [ + "UnityEngine.TestRunner", + "UnityEditor.TestRunner", + "UniRx.Async", + "UniRx.Async.Tests" + ], + "includePlatforms": [ + "Editor" + ], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": true, + "precompiledReferences": [ + "nunit.framework.dll" + ], + "autoReferenced": false, + "defineConstraints": [ + "UNITY_INCLUDE_TESTS" + ], + "versionDefines": [] +} \ No newline at end of file diff --git a/Assets/Tests/Editor/UniRx.Async.Tests.Editor.asmdef.meta b/Assets/Tests/Editor/UniRx.Async.Tests.Editor.asmdef.meta new file mode 100644 index 0000000..f89e315 --- /dev/null +++ b/Assets/Tests/Editor/UniRx.Async.Tests.Editor.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: c2431de67d1d97a48afcaf18f333a0b4 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Tests/Editor/WhenAnyTestEditor.cs b/Assets/Tests/Editor/WhenAnyTestEditor.cs new file mode 100644 index 0000000..f78bb4a --- /dev/null +++ b/Assets/Tests/Editor/WhenAnyTestEditor.cs @@ -0,0 +1,44 @@ +#if CSHARP_7_OR_LATER || (UNITY_2018_3_OR_NEWER && (NET_STANDARD_2_0 || NET_4_6)) +#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member + +using UnityEngine; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using UnityEngine.UI; +using UnityEngine.Scripting; +using UniRx; +using UniRx.Async; +using Unity.Collections; +using System.Threading; +using NUnit.Framework; +using UnityEngine.TestTools; +using FluentAssertions; + +namespace UniRx.AsyncTests +{ + public class WhenAnyTest + { + [UnityTest] + public IEnumerator WhenAnyCanceled() => UniTask.ToCoroutine(async () => + { + var cts = new CancellationTokenSource(); + var successDelayTask = UniTask.Delay(TimeSpan.FromSeconds(1)); + var cancelTask = UniTask.Delay(TimeSpan.FromSeconds(1), cancellationToken: cts.Token); + cts.CancelAfterSlim(200); + + try + { + var r = await UniTask.WhenAny(new[] { successDelayTask, cancelTask }); + } + catch (Exception ex) + { + ex.Should().BeAssignableTo(); + } + }); + } +} + +#endif \ No newline at end of file diff --git a/Assets/Tests/Editor/WhenAnyTestEditor.cs.meta b/Assets/Tests/Editor/WhenAnyTestEditor.cs.meta new file mode 100644 index 0000000..79cd322 --- /dev/null +++ b/Assets/Tests/Editor/WhenAnyTestEditor.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b5addd9aa1a794441af032a71208b495 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/UniRx.Async/Internal/ContinuationQueue.cs b/Assets/UniRx.Async/Internal/ContinuationQueue.cs index 41bb5be..f09be8a 100644 --- a/Assets/UniRx.Async/Internal/ContinuationQueue.cs +++ b/Assets/UniRx.Async/Internal/ContinuationQueue.cs @@ -64,6 +64,15 @@ namespace UniRx.Async.Internal } } + public void Clear() + { + actionListCount = 0; + actionList = new Action[InitialSize]; + + waitingListCount = 0; + waitingList = new Action[InitialSize]; + } + public void Run() { { diff --git a/Assets/UniRx.Async/Internal/PlayerLoopRunner.cs b/Assets/UniRx.Async/Internal/PlayerLoopRunner.cs index 86da337..7ee6de4 100644 --- a/Assets/UniRx.Async/Internal/PlayerLoopRunner.cs +++ b/Assets/UniRx.Async/Internal/PlayerLoopRunner.cs @@ -45,6 +45,17 @@ namespace UniRx.Async.Internal } } + public void Clear() + { + lock (arrayLock) + { + for (var index = 0; index < loopItems.Length; index++) + { + loopItems[index] = null; + } + } + } + public void Run() { lock (runningAndQueueLock) diff --git a/Assets/UniRx.Async/PlayerLoopHelper.cs b/Assets/UniRx.Async/PlayerLoopHelper.cs index 326edf7..8501f3a 100644 --- a/Assets/UniRx.Async/PlayerLoopHelper.cs +++ b/Assets/UniRx.Async/PlayerLoopHelper.cs @@ -13,6 +13,10 @@ using UnityEngine.LowLevel; using UnityEngine.Experimental.LowLevel; #endif +#if UNITY_EDITOR +using UnityEditor; +#endif + namespace UniRx.Async { public static class UniTaskLoopRunners @@ -62,38 +66,30 @@ namespace UniRx.Async static ContinuationQueue[] yielders; static PlayerLoopRunner[] runners; - static PlayerLoopSystem[] InsertRunner(PlayerLoopSystem loopSystem, Type loopRunnerYieldType, ContinuationQueue cq, Type loopRunnerType, PlayerLoopRunner runner) + static PlayerLoopSystem[] InsertRunner(PlayerLoopSystem loopSystem, Type loopRunnerYieldType, + ContinuationQueue cq, Type loopRunnerType, PlayerLoopRunner runner) { + EditorApplication.playModeStateChanged += (state) => + { + if (state==PlayModeStateChange.EnteredEditMode || state==PlayModeStateChange.EnteredPlayMode) return; + + if (runner != null) + runner.Clear(); + if (cq != null) + cq.Clear(); + }; + + var yieldLoop = new PlayerLoopSystem { type = loopRunnerYieldType, -#if UNITY_EDITOR - updateDelegate = () => - { - if (Application.isPlaying) - { - cq.Run(); - } - } -#else updateDelegate = cq.Run -#endif }; var runnerLoop = new PlayerLoopSystem { type = loopRunnerType, -#if UNITY_EDITOR - updateDelegate = () => - { - if (Application.isPlaying) - { - runner.Run(); - } - } -#else updateDelegate = runner.Run -#endif }; var dest = new PlayerLoopSystem[loopSystem.subSystemList.Length + 2]; @@ -122,6 +118,31 @@ namespace UniRx.Async Initialize(ref playerLoop); } + +#if UNITY_EDITOR + [InitializeOnLoadMethod] + static void InitOnEditor() + { + Init(); + + EditorApplication.update += ForceEditorPlayerLoopUpdate; + } + + + private static void ForceEditorPlayerLoopUpdate() + { + if (EditorApplication.isPlayingOrWillChangePlaymode || EditorApplication.isCompiling || + EditorApplication.isUpdating) + { + // Not in Edit mode, don't interfere + return; + } + + EditorApplication.QueuePlayerLoopUpdate(); + } + +#endif + public static void Initialize(ref PlayerLoopSystem playerLoop) { yielders = new ContinuationQueue[7]; diff --git a/UniRx.Async.Tests.Editor.csproj b/UniRx.Async.Tests.Editor.csproj new file mode 100644 index 0000000..e1ad17e --- /dev/null +++ b/UniRx.Async.Tests.Editor.csproj @@ -0,0 +1,648 @@ + + + + latest + <_TargetFrameworkDirectories>non_empty_path_generated_by_unity.rider.package + <_FullFrameworkReferenceAssemblyPaths>non_empty_path_generated_by_unity.rider.package + true + + + Debug + AnyCPU + 10.0.20506 + 2.0 + + {D573322C-5A2D-E1C7-B547-A0CD5FF159B2} + Library + Properties + UniRx.Async.Tests.Editor + v4.7.1 + 512 + . + + + true + full + false + Temp\bin\Debug\ + DEBUG;TRACE;UNITY_2019_2_3;UNITY_2019_2;UNITY_2019;UNITY_5_3_OR_NEWER;UNITY_5_4_OR_NEWER;UNITY_5_5_OR_NEWER;UNITY_5_6_OR_NEWER;UNITY_2017_1_OR_NEWER;UNITY_2017_2_OR_NEWER;UNITY_2017_3_OR_NEWER;UNITY_2017_4_OR_NEWER;UNITY_2018_1_OR_NEWER;UNITY_2018_2_OR_NEWER;UNITY_2018_3_OR_NEWER;UNITY_2018_4_OR_NEWER;UNITY_2019_1_OR_NEWER;UNITY_2019_2_OR_NEWER;PLATFORM_ARCH_64;UNITY_64;UNITY_INCLUDE_TESTS;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_TEXTURE_STREAMING;ENABLE_UNET;ENABLE_LZMA;ENABLE_UNITYEVENTS;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_CLOUD_SERVICES_COLLAB;ENABLE_CLOUD_SERVICES_COLLAB_SOFTLOCKS;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_SERVICES_USE_WEBREQUEST;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_EDITOR_HUB_LICENSE;ENABLE_WEBSOCKET_CLIENT;ENABLE_DIRECTOR_AUDIO;ENABLE_DIRECTOR_TEXTURE;ENABLE_MANAGED_JOBS;ENABLE_MANAGED_TRANSFORM_JOBS;ENABLE_MANAGED_ANIMATION_JOBS;ENABLE_MANAGED_AUDIO_JOBS;INCLUDE_DYNAMIC_GI;ENABLE_MONO_BDWGC;ENABLE_SCRIPTING_GC_WBARRIERS;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;ENABLE_VIDEO;PLATFORM_STANDALONE_WIN;PLATFORM_STANDALONE;UNITY_STANDALONE_WIN;UNITY_STANDALONE;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_UNITYWEBREQUEST;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_CRASH_REPORTING;ENABLE_OUT_OF_PROCESS_CRASH_HANDLER;ENABLE_EVENT_QUEUE;ENABLE_CLUSTER_SYNC;ENABLE_CLUSTERINPUT;ENABLE_VR;ENABLE_AR;ENABLE_WEBSOCKET_HOST;ENABLE_MONO;NET_STANDARD_2_0;ENABLE_PROFILER;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_WIN;ENABLE_UNITY_COLLECTIONS_CHECKS;ENABLE_BURST_AOT;UNITY_TEAM_LICENSE;ENABLE_CUSTOM_RENDER_TEXTURE;ENABLE_DIRECTOR;ENABLE_LOCALIZATION;ENABLE_SPRITES;ENABLE_TERRAIN;ENABLE_TILEMAP;ENABLE_TIMELINE;NET_4_6;CSHARP_7_OR_LATER;CSHARP_7_3_OR_NEWER + prompt + 4 + 0169 + False + + + pdbonly + true + Temp\bin\Release\ + prompt + 4 + 0169 + False + + + true + true + false + false + false + + + + C:\Program Files\Unity\Hub\Editor\2019.2.3f1\Editor\Data\Managed/UnityEngine/UnityEngine.dll + + + C:\Program Files\Unity\Hub\Editor\2019.2.3f1\Editor\Data\Managed/UnityEditor.dll + + + + + + + + E:/UnityProjects/MyProjects/UniTask/Library/ScriptAssemblies/UnityEngine.TestRunner.dll + + + E:/UnityProjects/MyProjects/UniTask/Library/ScriptAssemblies/UnityEditor.TestRunner.dll + + + E:/UnityProjects/MyProjects/UniTask/Library/ScriptAssemblies/UnityEditor.UI.dll + + + E:/UnityProjects/MyProjects/UniTask/Library/ScriptAssemblies/UnityEngine.UI.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/Managed/UnityEngine/UnityEngine.AIModule.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/Managed/UnityEngine/UnityEngine.ARModule.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/Managed/UnityEngine/UnityEngine.AccessibilityModule.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/Managed/UnityEngine/UnityEngine.AndroidJNIModule.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/Managed/UnityEngine/UnityEngine.AnimationModule.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/Managed/UnityEngine/UnityEngine.AssetBundleModule.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/Managed/UnityEngine/UnityEngine.AudioModule.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/Managed/UnityEngine/UnityEngine.ClothModule.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/Managed/UnityEngine/UnityEngine.ClusterInputModule.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/Managed/UnityEngine/UnityEngine.ClusterRendererModule.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/Managed/UnityEngine/UnityEngine.CoreModule.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/Managed/UnityEngine/UnityEngine.CrashReportingModule.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/Managed/UnityEngine/UnityEngine.DSPGraphModule.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/Managed/UnityEngine/UnityEngine.DirectorModule.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/Managed/UnityEngine/UnityEngine.FileSystemHttpModule.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/Managed/UnityEngine/UnityEngine.GameCenterModule.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/Managed/UnityEngine/UnityEngine.GridModule.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/Managed/UnityEngine/UnityEngine.HotReloadModule.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/Managed/UnityEngine/UnityEngine.IMGUIModule.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/Managed/UnityEngine/UnityEngine.ImageConversionModule.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/Managed/UnityEngine/UnityEngine.InputModule.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/Managed/UnityEngine/UnityEngine.InputLegacyModule.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/Managed/UnityEngine/UnityEngine.JSONSerializeModule.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/Managed/UnityEngine/UnityEngine.LocalizationModule.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/Managed/UnityEngine/UnityEngine.ParticleSystemModule.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/Managed/UnityEngine/UnityEngine.PerformanceReportingModule.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/Managed/UnityEngine/UnityEngine.PhysicsModule.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/Managed/UnityEngine/UnityEngine.Physics2DModule.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/Managed/UnityEngine/UnityEngine.ProfilerModule.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/Managed/UnityEngine/UnityEngine.ScreenCaptureModule.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/Managed/UnityEngine/UnityEngine.SharedInternalsModule.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/Managed/UnityEngine/UnityEngine.SpriteMaskModule.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/Managed/UnityEngine/UnityEngine.SpriteShapeModule.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/Managed/UnityEngine/UnityEngine.StreamingModule.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/Managed/UnityEngine/UnityEngine.SubstanceModule.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/Managed/UnityEngine/UnityEngine.TLSModule.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/Managed/UnityEngine/UnityEngine.TerrainModule.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/Managed/UnityEngine/UnityEngine.TerrainPhysicsModule.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/Managed/UnityEngine/UnityEngine.TextCoreModule.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/Managed/UnityEngine/UnityEngine.TextRenderingModule.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/Managed/UnityEngine/UnityEngine.TilemapModule.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/Managed/UnityEngine/UnityEngine.UIModule.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/Managed/UnityEngine/UnityEngine.UIElementsModule.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/Managed/UnityEngine/UnityEngine.UNETModule.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/Managed/UnityEngine/UnityEngine.UmbraModule.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/Managed/UnityEngine/UnityEngine.UnityAnalyticsModule.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/Managed/UnityEngine/UnityEngine.UnityConnectModule.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/Managed/UnityEngine/UnityEngine.UnityTestProtocolModule.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/Managed/UnityEngine/UnityEngine.UnityWebRequestModule.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/Managed/UnityEngine/UnityEngine.UnityWebRequestAssetBundleModule.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/Managed/UnityEngine/UnityEngine.UnityWebRequestAudioModule.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/Managed/UnityEngine/UnityEngine.UnityWebRequestTextureModule.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/Managed/UnityEngine/UnityEngine.UnityWebRequestWWWModule.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/Managed/UnityEngine/UnityEngine.VFXModule.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/Managed/UnityEngine/UnityEngine.VRModule.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/Managed/UnityEngine/UnityEngine.VehiclesModule.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/Managed/UnityEngine/UnityEngine.VideoModule.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/Managed/UnityEngine/UnityEngine.WindModule.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/Managed/UnityEngine/UnityEngine.XRModule.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/UnityExtensions/Unity/UnityVR/Editor/UnityEditor.VR.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/Managed/UnityEditor.Graphs.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/PlaybackEngines/WindowsStandaloneSupport/UnityEditor.WindowsStandalone.Extensions.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/PlaybackEngines/AndroidPlayer/UnityEditor.Android.Extensions.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/PlaybackEngines/iOSSupport/UnityEditor.iOS.Extensions.dll + + + E:/UnityProjects/MyProjects/UniTask/Library/PackageCache/com.unity.ext.nunit@1.0.0/net35/unity-custom/nunit.framework.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/PlaybackEngines/iOSSupport/UnityEditor.iOS.Extensions.Xcode.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/PlaybackEngines/iOSSupport/UnityEditor.iOS.Extensions.Common.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/mscorlib.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/System.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/System.Core.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/System.Runtime.Serialization.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/System.Xml.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/System.Xml.Linq.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/System.Numerics.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/System.Numerics.Vectors.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/System.Net.Http.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Microsoft.CSharp.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/System.Data.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/Microsoft.Win32.Primitives.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/netstandard.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.AppContext.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Collections.Concurrent.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Collections.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Collections.NonGeneric.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Collections.Specialized.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.ComponentModel.Annotations.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.ComponentModel.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.ComponentModel.EventBasedAsync.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.ComponentModel.Primitives.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.ComponentModel.TypeConverter.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Console.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Data.Common.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Diagnostics.Contracts.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Diagnostics.Debug.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Diagnostics.FileVersionInfo.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Diagnostics.Process.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Diagnostics.StackTrace.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Diagnostics.TextWriterTraceListener.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Diagnostics.Tools.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Diagnostics.TraceSource.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Drawing.Primitives.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Dynamic.Runtime.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Globalization.Calendars.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Globalization.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Globalization.Extensions.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.IO.Compression.ZipFile.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.IO.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.IO.FileSystem.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.IO.FileSystem.DriveInfo.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.IO.FileSystem.Primitives.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.IO.FileSystem.Watcher.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.IO.IsolatedStorage.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.IO.MemoryMappedFiles.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.IO.Pipes.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.IO.UnmanagedMemoryStream.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Linq.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Linq.Expressions.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Linq.Parallel.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Linq.Queryable.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Net.Http.Rtc.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Net.NameResolution.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Net.NetworkInformation.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Net.Ping.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Net.Primitives.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Net.Requests.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Net.Security.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Net.Sockets.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Net.WebHeaderCollection.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Net.WebSockets.Client.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Net.WebSockets.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.ObjectModel.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Reflection.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Reflection.Emit.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Reflection.Emit.ILGeneration.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Reflection.Emit.Lightweight.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Reflection.Extensions.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Reflection.Primitives.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Resources.Reader.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Resources.ResourceManager.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Resources.Writer.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Runtime.CompilerServices.VisualC.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Runtime.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Runtime.Extensions.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Runtime.Handles.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Runtime.InteropServices.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Runtime.InteropServices.RuntimeInformation.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Runtime.InteropServices.WindowsRuntime.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Runtime.Numerics.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Runtime.Serialization.Formatters.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Runtime.Serialization.Json.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Runtime.Serialization.Primitives.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Runtime.Serialization.Xml.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Security.Claims.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Security.Cryptography.Algorithms.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Security.Cryptography.Csp.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Security.Cryptography.Encoding.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Security.Cryptography.Primitives.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Security.Cryptography.X509Certificates.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Security.Principal.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Security.SecureString.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.ServiceModel.Duplex.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.ServiceModel.Http.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.ServiceModel.NetTcp.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.ServiceModel.Primitives.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.ServiceModel.Security.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Text.Encoding.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Text.Encoding.Extensions.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Text.RegularExpressions.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Threading.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Threading.Overlapped.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Threading.Tasks.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Threading.Tasks.Parallel.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Threading.Thread.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Threading.ThreadPool.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Threading.Timer.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.ValueTuple.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Xml.ReaderWriter.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Xml.XDocument.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Xml.XmlDocument.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Xml.XmlSerializer.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Xml.XPath.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.Xml.XPath.XDocument.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/unityscript/UnityScript.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/unityscript/UnityScript.Lang.dll + + + C:/Program Files/Unity/Hub/Editor/2019.2.3f1/Editor/Data/MonoBleedingEdge/lib/mono/unityscript/Boo.Lang.dll + + + + + {6F442575-7EE1-7C8E-DD7C-72CCB706BBC7} + UniRx.Async + + + {23334862-7730-AC80-7963-2D3336B7B384} + UniRx.Async.Tests + + + + + From d639283f592f28c39cb418cfbacd1cf7962f943e Mon Sep 17 00:00:00 2001 From: Antonio Date: Mon, 9 Sep 2019 13:34:13 +0200 Subject: [PATCH 2/3] Add comments --- Assets/UniRx.Async/PlayerLoopHelper.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Assets/UniRx.Async/PlayerLoopHelper.cs b/Assets/UniRx.Async/PlayerLoopHelper.cs index 8501f3a..5171469 100644 --- a/Assets/UniRx.Async/PlayerLoopHelper.cs +++ b/Assets/UniRx.Async/PlayerLoopHelper.cs @@ -123,8 +123,10 @@ namespace UniRx.Async [InitializeOnLoadMethod] static void InitOnEditor() { + //Execute the play mode init method Init(); + //register an Editor update delegate, used to forcing playerLoop update EditorApplication.update += ForceEditorPlayerLoopUpdate; } @@ -138,6 +140,7 @@ namespace UniRx.Async return; } + //force unity to update PlayerLoop callbacks EditorApplication.QueuePlayerLoopUpdate(); } From 7e26573abbd196c5b9c8fd10758f1f3a26e68877 Mon Sep 17 00:00:00 2001 From: Antonio Date: Thu, 27 Feb 2020 19:14:02 +0100 Subject: [PATCH 3/3] updated to unity 2019.3.2f1, fix missing UNITY_EDITOR preprocessor --- Assets/UniRx.Async/PlayerLoopHelper.cs | 10 ++++++---- ProjectSettings/EditorSettings.asset | 20 +++++++++++++++++--- ProjectSettings/ProjectVersion.txt | 4 ++-- 3 files changed, 25 insertions(+), 9 deletions(-) diff --git a/Assets/UniRx.Async/PlayerLoopHelper.cs b/Assets/UniRx.Async/PlayerLoopHelper.cs index 5171469..978d356 100644 --- a/Assets/UniRx.Async/PlayerLoopHelper.cs +++ b/Assets/UniRx.Async/PlayerLoopHelper.cs @@ -69,17 +69,19 @@ namespace UniRx.Async static PlayerLoopSystem[] InsertRunner(PlayerLoopSystem loopSystem, Type loopRunnerYieldType, ContinuationQueue cq, Type loopRunnerType, PlayerLoopRunner runner) { +#if UNITY_EDITOR EditorApplication.playModeStateChanged += (state) => { - if (state==PlayModeStateChange.EnteredEditMode || state==PlayModeStateChange.EnteredPlayMode) return; - + if (state == PlayModeStateChange.EnteredEditMode || + state == PlayModeStateChange.EnteredPlayMode) return; + if (runner != null) runner.Clear(); if (cq != null) cq.Clear(); }; - - +#endif + var yieldLoop = new PlayerLoopSystem { type = loopRunnerYieldType, diff --git a/ProjectSettings/EditorSettings.asset b/ProjectSettings/EditorSettings.asset index 8d9e83b..14e45f0 100644 --- a/ProjectSettings/EditorSettings.asset +++ b/ProjectSettings/EditorSettings.asset @@ -3,19 +3,33 @@ --- !u!159 &1 EditorSettings: m_ObjectHideFlags: 0 - serializedVersion: 7 + serializedVersion: 9 m_ExternalVersionControlSupport: Visible Meta Files m_SerializationMode: 2 m_LineEndingsForNewScripts: 2 m_DefaultBehaviorMode: 1 + m_PrefabRegularEnvironment: {fileID: 0} + m_PrefabUIEnvironment: {fileID: 0} m_SpritePackerMode: 4 m_SpritePackerPaddingPower: 1 m_EtcTextureCompressorBehavior: 1 m_EtcTextureFastCompressor: 1 m_EtcTextureNormalCompressor: 2 m_EtcTextureBestCompressor: 4 - m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd + m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd;asmref m_ProjectGenerationRootNamespace: - m_UserGeneratedProjectSuffix: m_CollabEditorSettings: inProgressEnabled: 1 + m_EnableTextureStreamingInEditMode: 1 + m_EnableTextureStreamingInPlayMode: 1 + m_AsyncShaderCompilation: 1 + m_EnterPlayModeOptionsEnabled: 0 + m_EnterPlayModeOptions: 3 + m_ShowLightmapResolutionOverlay: 1 + m_UseLegacyProbeSampleCount: 1 + m_AssetPipelineMode: 1 + m_CacheServerMode: 0 + m_CacheServerEndpoint: + m_CacheServerNamespacePrefix: default + m_CacheServerEnableDownload: 1 + m_CacheServerEnableUpload: 1 diff --git a/ProjectSettings/ProjectVersion.txt b/ProjectSettings/ProjectVersion.txt index 83a1801..f04fc72 100644 --- a/ProjectSettings/ProjectVersion.txt +++ b/ProjectSettings/ProjectVersion.txt @@ -1,2 +1,2 @@ -m_EditorVersion: 2019.3.0a2 -m_EditorVersionWithRevision: 2019.3.0a2 (fa7740529556) +m_EditorVersion: 2019.3.2f1 +m_EditorVersionWithRevision: 2019.3.2f1 (c46a3a38511e)