mirror of
https://github.com/Cysharp/UniTask.git
synced 2026-05-17 04:30:13 +00:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
28e1fa98c9 | ||
|
|
9f7b897837 | ||
|
|
341953b441 | ||
|
|
623936c7b8 | ||
|
|
b4ec35aadd | ||
|
|
6c64205292 | ||
|
|
e6734478c5 |
@@ -82,12 +82,6 @@ workflows:
|
|||||||
# - build-and-test:
|
# - build-and-test:
|
||||||
# unity_version: 2019.2.0b2
|
# unity_version: 2019.2.0b2
|
||||||
# unity_license: ${UNITY_LICENSE_2019_2}
|
# unity_license: ${UNITY_LICENSE_2019_2}
|
||||||
- build-and-create-package:
|
|
||||||
unity_version: 2019.1.2f1
|
|
||||||
unity_license: ${UNITY_LICENSE_2019_1}
|
|
||||||
filters:
|
|
||||||
tags:
|
|
||||||
only: /.*/
|
|
||||||
- build-and-test:
|
- build-and-test:
|
||||||
unity_version: 2019.1.2f1
|
unity_version: 2019.1.2f1
|
||||||
unity_license: ${UNITY_LICENSE_2019_1}
|
unity_license: ${UNITY_LICENSE_2019_1}
|
||||||
@@ -102,7 +96,7 @@ workflows:
|
|||||||
# - build-and-test:
|
# - build-and-test:
|
||||||
# unity_version: 2018.3.12f1
|
# unity_version: 2018.3.12f1
|
||||||
# unity_license: ${UNITY_LICENSE_2018_3}
|
# unity_license: ${UNITY_LICENSE_2018_3}
|
||||||
- build-and-create-package-release:
|
- build-and-create-package:
|
||||||
unity_version: 2019.1.2f1
|
unity_version: 2019.1.2f1
|
||||||
unity_license: ${UNITY_LICENSE_2019_1}
|
unity_license: ${UNITY_LICENSE_2019_1}
|
||||||
filters:
|
filters:
|
||||||
@@ -112,9 +106,9 @@ workflows:
|
|||||||
ignore: /.*/
|
ignore: /.*/
|
||||||
- upload-github:
|
- upload-github:
|
||||||
requires:
|
requires:
|
||||||
- build-and-create-package-release
|
- build-and-create-package
|
||||||
filters:
|
filters:
|
||||||
tags:
|
tags:
|
||||||
only: /^\d\.\d\.\d.*/
|
only: /^\d\.\d\.\d.*/
|
||||||
branches:
|
branches:
|
||||||
ignore: /.*/
|
ignore: /.*/
|
||||||
|
|||||||
@@ -14,13 +14,47 @@ public class SandboxMain : MonoBehaviour
|
|||||||
public Button cancelButton;
|
public Button cancelButton;
|
||||||
CancellationTokenSource cts;
|
CancellationTokenSource cts;
|
||||||
|
|
||||||
async void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
UnityEngine.Debug.Log("DOWNLOAD START:" + Time.frameCount);
|
okButton.onClick.AddListener(() =>
|
||||||
|
{
|
||||||
var req = await UnityWebRequest.Get(Path.Combine(Application.streamingAssetsPath, "test.txt")).SendWebRequest();
|
FooAsync().Forget();
|
||||||
|
});
|
||||||
UnityEngine.Debug.Log("DOWNLOAD RESULT:" + Time.frameCount + ", " + req.downloadHandler.text);
|
cancelButton.onClick.AddListener(() =>
|
||||||
|
{
|
||||||
|
BarAsync().Forget();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async UniTask<int> FooAsync()
|
||||||
|
{
|
||||||
|
// use F10, will crash.
|
||||||
|
var loop = int.Parse("9");
|
||||||
|
await UniTask.DelayFrame(loop);
|
||||||
|
|
||||||
|
Debug.Log("OK");
|
||||||
|
await UniTask.DelayFrame(loop);
|
||||||
|
|
||||||
|
Debug.Log("Again");
|
||||||
|
|
||||||
|
return 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
async UniTaskVoid BarAsync()
|
||||||
|
{
|
||||||
|
var loop = int.Parse("10");
|
||||||
|
|
||||||
|
|
||||||
|
var foo = await UniTask.FromResult(100);
|
||||||
|
|
||||||
|
Debug.Log("OK");
|
||||||
|
|
||||||
|
|
||||||
|
Debug.Log("Again");
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -136,6 +136,22 @@ namespace UniRx.Async.CompilerServices
|
|||||||
public void SetStateMachine(IAsyncStateMachine stateMachine)
|
public void SetStateMachine(IAsyncStateMachine stateMachine)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
// Important for IDE debugger.
|
||||||
|
object debuggingId;
|
||||||
|
private object ObjectIdForDebugger
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (debuggingId == null)
|
||||||
|
{
|
||||||
|
debuggingId = new object();
|
||||||
|
}
|
||||||
|
return debuggingId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -268,6 +284,22 @@ namespace UniRx.Async.CompilerServices
|
|||||||
public void SetStateMachine(IAsyncStateMachine stateMachine)
|
public void SetStateMachine(IAsyncStateMachine stateMachine)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
// Important for IDE debugger.
|
||||||
|
object debuggingId;
|
||||||
|
private object ObjectIdForDebugger
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (debuggingId == null)
|
||||||
|
{
|
||||||
|
debuggingId = new object();
|
||||||
|
}
|
||||||
|
return debuggingId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -84,6 +84,22 @@ namespace UniRx.Async.CompilerServices
|
|||||||
public void SetStateMachine(IAsyncStateMachine stateMachine)
|
public void SetStateMachine(IAsyncStateMachine stateMachine)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
// Important for IDE debugger.
|
||||||
|
object debuggingId;
|
||||||
|
private object ObjectIdForDebugger
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (debuggingId == null)
|
||||||
|
{
|
||||||
|
debuggingId = new object();
|
||||||
|
}
|
||||||
|
return debuggingId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ namespace UniRx.Async
|
|||||||
// left, right both suppress operation canceled exception.
|
// left, right both suppress operation canceled exception.
|
||||||
|
|
||||||
var delayCancellationTokenSource = new CancellationTokenSource();
|
var delayCancellationTokenSource = new CancellationTokenSource();
|
||||||
var timeoutTask = (UniTask)UniTask.Delay(timeout, ignoreTimeScale, timeoutCheckTiming).SuppressCancellationThrow();
|
var timeoutTask = (UniTask)UniTask.Delay(timeout, ignoreTimeScale, timeoutCheckTiming, delayCancellationTokenSource.Token).SuppressCancellationThrow();
|
||||||
|
|
||||||
var (hasValue, value) = await UniTask.WhenAny(task.SuppressCancellationThrow(), timeoutTask);
|
var (hasValue, value) = await UniTask.WhenAny(task.SuppressCancellationThrow(), timeoutTask);
|
||||||
|
|
||||||
@@ -147,7 +147,7 @@ namespace UniRx.Async
|
|||||||
// left, right both suppress operation canceled exception.
|
// left, right both suppress operation canceled exception.
|
||||||
|
|
||||||
var delayCancellationTokenSource = new CancellationTokenSource();
|
var delayCancellationTokenSource = new CancellationTokenSource();
|
||||||
var timeoutTask = (UniTask)UniTask.Delay(timeout, ignoreTimeScale, timeoutCheckTiming).SuppressCancellationThrow();
|
var timeoutTask = (UniTask)UniTask.Delay(timeout, ignoreTimeScale, timeoutCheckTiming, delayCancellationTokenSource.Token).SuppressCancellationThrow();
|
||||||
|
|
||||||
var (hasValue, value) = await UniTask.WhenAny(task.SuppressCancellationThrow(), timeoutTask);
|
var (hasValue, value) = await UniTask.WhenAny(task.SuppressCancellationThrow(), timeoutTask);
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "com.cysharp.unitask",
|
"name": "com.cysharp.unitask",
|
||||||
"displayName": "UniTask",
|
"displayName": "UniTask",
|
||||||
"version": "1.3.0",
|
"version": "1.3.1",
|
||||||
"unity": "2018.3",
|
"unity": "2018.3",
|
||||||
"description": "Provides an efficient async/await integration to Unity.",
|
"description": "Provides an efficient async/await integration to Unity.",
|
||||||
"keywords": ["async/await", "async", "Task", "UniTask"],
|
"keywords": ["async/await", "async", "Task", "UniTask"],
|
||||||
|
|||||||
@@ -241,7 +241,7 @@ public class Foo : MonoBehaviour, IProgress<float>
|
|||||||
|
|
||||||
UniTaskTracker
|
UniTaskTracker
|
||||||
---
|
---
|
||||||
useful for check(leak) UniTasks. You can open tracker window in `Window -> UniRx -> UniTask Tracker`.
|
useful for check(leak) UniTasks. You can open tracker window in `Window -> UniTask Tracker`.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
@@ -352,6 +352,8 @@ After Unity 2019.3.4f1, Unity 2020.1a21, that support path query parameter of gi
|
|||||||
|
|
||||||
or add `"com.cysharp.unitask": "https://github.com/Cysharp/UniTask.git?path=Assets/UniRx.Async"` to `Packages/manifest.json`.
|
or add `"com.cysharp.unitask": "https://github.com/Cysharp/UniTask.git?path=Assets/UniRx.Async"` to `Packages/manifest.json`.
|
||||||
|
|
||||||
|
If you want to set a target version, UniTask is using `*.*.*` release tag so you can specify a version like `#1.3.0`. For example `https://github.com/Cysharp/UniTask.git?path=Assets/UniRx.Async#1.3.1`.
|
||||||
|
|
||||||
License
|
License
|
||||||
---
|
---
|
||||||
This library is under the MIT License.
|
This library is under the MIT License.
|
||||||
Reference in New Issue
Block a user