Compare commits

..

9 Commits
1.0.0 ... 1.1.0

Author SHA1 Message Date
neuecc
f82c762263 Prevent UnitTasks from continuing after exiting play mode #22 2019-06-28 20:41:04 +09:00
Yoshifumi Kawai
021a1da1fa Merge pull request #23 from TamuraKazunori/fix_enumerator_async
Fixed nested IEnumerator does not consumed
2019-06-28 20:25:02 +09:00
Kazunori Tamura
5a934d382f Add test of nested IEnumerator 2019-06-28 11:57:42 +09:00
Kazunori Tamura
fed4ba76b5 Fixed nested IEnumerator does not consumed 2019-06-28 10:24:31 +09:00
Yoshifumi Kawai
d98ceadfe9 Update README.md 2019-06-10 12:19:56 +09:00
Yoshifumi Kawai
b5774baccf Update README.md 2019-06-08 21:19:15 +09:00
Yoshifumi Kawai
9c8d9b2633 Update README.md 2019-06-06 12:28:27 +09:00
neuecc
940e81034e CI 2019-06-06 11:58:19 +09:00
neuecc
d35d7dad3e pkg name 2019-06-06 11:55:30 +09:00
5 changed files with 56 additions and 15 deletions

View File

@@ -36,7 +36,8 @@ jobs:
name: Build Linux(Mono)
command: /opt/Unity/Editor/Unity -quit -batchmode -nographics -silent-crashes -logFile -projectPath . -executeMethod UnitTestBuilder.BuildUnitTest /headless /ScriptBackend Mono2x /BuildTarget StandaloneLinux64
working_directory: .
- run: ./bin/UnitTest/StandaloneLinux64_Mono2x/test
# TODO:check unity version and packages...
# - run: ./bin/UnitTest/StandaloneLinux64_Mono2x/test
build-and-create-package:
parameters:
unity_version: {type: string}

View File

@@ -195,7 +195,6 @@ namespace UniRx.AsyncTests
var currentThreadId = Thread.CurrentThread.ManagedThreadId;
UnityEngine.Debug.Log("Before:" + currentThreadId);
await UniTask.SwitchToThreadPool();
@@ -209,7 +208,6 @@ namespace UniRx.AsyncTests
var switchedThreadId = Thread.CurrentThread.ManagedThreadId;
UnityEngine.Debug.Log("After:" + switchedThreadId);
currentThreadId.Should().NotBe(switchedThreadId);
@@ -376,6 +374,27 @@ namespace UniRx.AsyncTests
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
}

View File

@@ -191,7 +191,8 @@ namespace UniRx.Async
}
else if (current is IEnumerator e3)
{
while (e3.MoveNext())
var e4 = ConsumeEnumerator(e3);
while (e4.MoveNext())
{
yield return null;
}
@@ -231,14 +232,6 @@ namespace UniRx.Async
};
}
static IEnumerator UnwrapEnumerator(IEnumerator enumerator)
{
while (enumerator.MoveNext())
{
yield return null;
}
}
static IEnumerator UnwrapWaitAsyncOperation(AsyncOperation asyncOperation)
{
while (!asyncOperation.isDone)

View File

@@ -67,13 +67,33 @@ namespace UniRx.Async
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];

View File

@@ -4,11 +4,11 @@
Provides an efficient async/await integration to Unity.
> UniTask was included in UniRx before v6 but now completely separated, it no dependent each other.
> UniTask was included in UniRx before v7 but now completely separated, it no dependent each other.
Getting started
---
Install package is available in [UniTask/releases](https://github.com/Cysharp/UniTask/releases) page.
Install package(`UniRx.Async.unitypackage`) is available in [UniTask/releases](https://github.com/Cysharp/UniTask/releases) page.
```csharp
// extension awaiter/methods can be used by this namespace
@@ -192,6 +192,14 @@ UniTask.DelayFrame
UniTask.Delay(..., bool ignoreTimeScale = false, ...) parameter
```
Cancellation
---
async void vs async UniTask/UniTaskVoid
---
Progress
---
For Unit Testing
---
@@ -201,4 +209,4 @@ Reference
License
---
This library is under the MIT License.
This library is under the MIT License.