mirror of
https://github.com/Cysharp/UniTask.git
synced 2026-05-24 08:40:10 +00:00
Prevent UnitTasks from continuing after exiting play mode #22
This commit is contained in:
@@ -195,7 +195,6 @@ namespace UniRx.AsyncTests
|
|||||||
|
|
||||||
var currentThreadId = Thread.CurrentThread.ManagedThreadId;
|
var currentThreadId = Thread.CurrentThread.ManagedThreadId;
|
||||||
|
|
||||||
UnityEngine.Debug.Log("Before:" + currentThreadId);
|
|
||||||
|
|
||||||
|
|
||||||
await UniTask.SwitchToThreadPool();
|
await UniTask.SwitchToThreadPool();
|
||||||
@@ -209,7 +208,6 @@ namespace UniRx.AsyncTests
|
|||||||
|
|
||||||
var switchedThreadId = Thread.CurrentThread.ManagedThreadId;
|
var switchedThreadId = Thread.CurrentThread.ManagedThreadId;
|
||||||
|
|
||||||
UnityEngine.Debug.Log("After:" + switchedThreadId);
|
|
||||||
|
|
||||||
|
|
||||||
currentThreadId.Should().NotBe(switchedThreadId);
|
currentThreadId.Should().NotBe(switchedThreadId);
|
||||||
|
|||||||
@@ -232,14 +232,6 @@ namespace UniRx.Async
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
static IEnumerator UnwrapEnumerator(IEnumerator enumerator)
|
|
||||||
{
|
|
||||||
while (enumerator.MoveNext())
|
|
||||||
{
|
|
||||||
yield return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static IEnumerator UnwrapWaitAsyncOperation(AsyncOperation asyncOperation)
|
static IEnumerator UnwrapWaitAsyncOperation(AsyncOperation asyncOperation)
|
||||||
{
|
{
|
||||||
while (!asyncOperation.isDone)
|
while (!asyncOperation.isDone)
|
||||||
|
|||||||
@@ -67,13 +67,33 @@ namespace UniRx.Async
|
|||||||
var yieldLoop = new PlayerLoopSystem
|
var yieldLoop = new PlayerLoopSystem
|
||||||
{
|
{
|
||||||
type = loopRunnerYieldType,
|
type = loopRunnerYieldType,
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
updateDelegate = () =>
|
||||||
|
{
|
||||||
|
if (Application.isPlaying)
|
||||||
|
{
|
||||||
|
cq.Run();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
updateDelegate = cq.Run
|
updateDelegate = cq.Run
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
var runnerLoop = new PlayerLoopSystem
|
var runnerLoop = new PlayerLoopSystem
|
||||||
{
|
{
|
||||||
type = loopRunnerType,
|
type = loopRunnerType,
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
updateDelegate = () =>
|
||||||
|
{
|
||||||
|
if (Application.isPlaying)
|
||||||
|
{
|
||||||
|
runner.Run();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
updateDelegate = runner.Run
|
updateDelegate = runner.Run
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
var dest = new PlayerLoopSystem[loopSystem.subSystemList.Length + 2];
|
var dest = new PlayerLoopSystem[loopSystem.subSystemList.Length + 2];
|
||||||
|
|||||||
Reference in New Issue
Block a user