mirror of
https://github.com/Cysharp/UniTask.git
synced 2026-05-15 19:40:09 +00:00
Compare commits
36 Commits
moreasmdef
...
2.2.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3cc0c80b1e | ||
|
|
cdda33a98e | ||
|
|
e57a4332ec | ||
|
|
e88e553cc9 | ||
|
|
a1a38d0d7c | ||
|
|
c9bebd6550 | ||
|
|
42047070dd | ||
|
|
316f3bd963 | ||
|
|
5f96e646d4 | ||
|
|
186114996c | ||
|
|
841b6e85ae | ||
|
|
7ac9853cf6 | ||
|
|
0ec45b9da6 | ||
|
|
dfd0fe9fe4 | ||
|
|
4710268e0a | ||
|
|
cae512e4de | ||
|
|
6351d4c5a4 | ||
|
|
1173bb4f34 | ||
|
|
e4272b5337 | ||
|
|
b660506e31 | ||
|
|
2c101aef08 | ||
|
|
498b2a4f81 | ||
|
|
a8c2fd420a | ||
|
|
dade7fdc76 | ||
|
|
1c8b16f798 | ||
|
|
89649d8777 | ||
|
|
9894bf875b | ||
|
|
45a800330b | ||
|
|
19b5f921a1 | ||
|
|
8cd577904e | ||
|
|
309d661bcc | ||
|
|
8736024d9b | ||
|
|
97680e57a8 | ||
|
|
7535c84581 | ||
|
|
690f3a2ead | ||
|
|
88371d08b9 |
50
.github/workflows/build-debug.yml
vendored
50
.github/workflows/build-debug.yml
vendored
@@ -29,39 +29,45 @@ jobs:
|
|||||||
if: "!(contains(github.event.head_commit.message, '[skip ci]') || contains(github.event.head_commit.message, '[ci skip]')) && ((github.event_name == 'push' && github.repository_owner == 'Cysharp') || startsWith(github.event.pull_request.head.label, 'Cysharp:'))"
|
if: "!(contains(github.event.head_commit.message, '[skip ci]') || contains(github.event.head_commit.message, '[ci skip]')) && ((github.event_name == 'push' && github.repository_owner == 'Cysharp') || startsWith(github.event.pull_request.head.label, 'Cysharp:'))"
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
unity: ["2019.3.9f1", "2020.1.0b5"]
|
unity: ["2019.3.9f1", "2019.4.13f1", "2020.1.12f1"]
|
||||||
include:
|
include:
|
||||||
- unity: 2019.3.9f1
|
- unity: 2019.3.9f1
|
||||||
license: UNITY_2019_3
|
license: UNITY_LICENSE_2019
|
||||||
- unity: 2020.1.0b5
|
- unity: 2019.4.13f1
|
||||||
license: UNITY_2020_1
|
license: UNITY_LICENSE_2019
|
||||||
|
- unity: 2020.1.12f1
|
||||||
|
license: UNITY_LICENSE_2020
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
|
||||||
# with linux-il2cpp. image from https://hub.docker.com/r/gableroux/unity3d/tags
|
|
||||||
image: gableroux/unity3d:${{ matrix.unity }}-linux-il2cpp
|
|
||||||
steps:
|
steps:
|
||||||
# Ubuntu 18.04 git is too old, use ppa latest git.
|
|
||||||
- run: |
|
|
||||||
apt-get update && apt-get install --no-install-recommends -y software-properties-common && add-apt-repository -y ppa:git-core/ppa
|
|
||||||
apt-get update && apt-get install --no-install-recommends -y git
|
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- run: echo -n "$UNITY_LICENSE" >> .Unity.ulf
|
# Execute scripts: RuntimeUnitTestToolkit
|
||||||
|
# /opt/Unity/Editor/Unity -quit -batchmode -nographics -silent-crashes -logFile -projectPath . -executeMethod UnitTestBuilder.BuildUnitTest /headless /ScriptBackend mono /BuildTarget StandaloneLinux64
|
||||||
|
- name: Build UnitTest(Linux64, mono)
|
||||||
|
uses: game-ci/unity-builder@v2.0-alpha-6
|
||||||
env:
|
env:
|
||||||
UNITY_LICENSE: ${{ secrets[matrix.license] }}
|
UNITY_LICENSE: ${{ secrets[matrix.license] }}
|
||||||
- name: Activate Unity, always returns a success. But if a subsequent run fails, the activation may have failed(if succeeded, shows `Next license update check is after` and not shows other message(like GUID != GUID). If fails not). In that case, upload the artifact's .alf file to https://license.unity3d.com/manual to get the .ulf file and set it to secrets.
|
with:
|
||||||
run: /opt/Unity/Editor/Unity -quit -batchmode -nographics -silent-crashes -logFile -manualLicenseFile .Unity.ulf || exit 0
|
projectPath: src/UniTask
|
||||||
|
unityVersion: ${{ matrix.unity }}
|
||||||
# Execute scripts: RuntimeUnitTestToolkit
|
targetPlatform: StandaloneLinux64
|
||||||
- name: Build UnitTest(Linux64, mono)
|
buildMethod: UnitTestBuilder.BuildUnitTest
|
||||||
run: /opt/Unity/Editor/Unity -quit -batchmode -nographics -silent-crashes -logFile -projectPath . -executeMethod UnitTestBuilder.BuildUnitTest /headless /ScriptBackend mono /BuildTarget StandaloneLinux64
|
customParameters: /headless /ScriptBackend mono
|
||||||
working-directory: src/UniTask
|
versioning: None
|
||||||
- name: Execute UnitTest
|
- name: Execute UnitTest
|
||||||
run: ./src/UniTask/bin/UnitTest/StandaloneLinux64_Mono2x/test
|
run: ./src/UniTask/bin/UnitTest/StandaloneLinux64_Mono2x/test
|
||||||
|
|
||||||
# Execute scripts: Export Package
|
# Execute scripts: Export Package
|
||||||
|
# /opt/Unity/Editor/Unity -quit -batchmode -nographics -silent-crashes -logFile -projectPath . -executeMethod PackageExporter.Export
|
||||||
- name: Export unitypackage
|
- name: Export unitypackage
|
||||||
run: /opt/Unity/Editor/Unity -quit -batchmode -nographics -silent-crashes -logFile -projectPath . -executeMethod PackageExporter.Export
|
uses: game-ci/unity-builder@v2.0-alpha-6
|
||||||
working-directory: src/UniTask
|
env:
|
||||||
|
UNITY_LICENSE: ${{ secrets[matrix.license] }}
|
||||||
|
with:
|
||||||
|
projectPath: src/UniTask
|
||||||
|
unityVersion: ${{ matrix.unity }}
|
||||||
|
targetPlatform: StandaloneLinux64
|
||||||
|
buildMethod: PackageExporter.Export
|
||||||
|
versioning: None
|
||||||
|
|
||||||
- name: check all .meta is commited
|
- name: check all .meta is commited
|
||||||
run: |
|
run: |
|
||||||
@@ -76,5 +82,5 @@ jobs:
|
|||||||
# Store artifacts.
|
# Store artifacts.
|
||||||
- uses: actions/upload-artifact@v2
|
- uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: UniTask.unitypackage.zip
|
name: UniTask.unitypackage-${{ matrix.unity }}.zip
|
||||||
path: ./src/UniTask/*.unitypackage
|
path: ./src/UniTask/*.unitypackage
|
||||||
|
|||||||
28
.github/workflows/build-release.yml
vendored
28
.github/workflows/build-release.yml
vendored
@@ -94,30 +94,26 @@ jobs:
|
|||||||
unity: ["2019.3.9f1"]
|
unity: ["2019.3.9f1"]
|
||||||
include:
|
include:
|
||||||
- unity: 2019.3.9f1
|
- unity: 2019.3.9f1
|
||||||
license: UNITY_2019_3
|
license: UNITY_LICENSE_2019
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 15
|
timeout-minutes: 15
|
||||||
container:
|
|
||||||
# with linux-il2cpp. image from https://hub.docker.com/r/gableroux/unity3d/tags
|
|
||||||
image: gableroux/unity3d:${{ matrix.unity }}-linux-il2cpp
|
|
||||||
steps:
|
steps:
|
||||||
# Ubuntu 18.04 git is too old, use ppa latest git.
|
- run: echo ${{ needs.update-packagejson.outputs.sha }}
|
||||||
- run: |
|
|
||||||
apt-get update && apt-get install --no-install-recommends -y software-properties-common && add-apt-repository -y ppa:git-core/ppa
|
|
||||||
apt-get update && apt-get install --no-install-recommends -y git
|
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
ref: ${{ needs.update-packagejson.outputs.sha }}
|
ref: ${{ needs.update-packagejson.outputs.sha }}
|
||||||
# activate Unity from manual license file(ulf)
|
# Execute scripts: Export Package
|
||||||
- run: echo -n "$UNITY_LICENSE" >> .Unity.ulf
|
# /opt/Unity/Editor/Unity -quit -batchmode -nographics -silent-crashes -logFile -projectPath . -executeMethod PackageExporter.Export
|
||||||
|
- name: Export unitypackage
|
||||||
|
uses: game-ci/unity-builder@v2.0-alpha-6
|
||||||
env:
|
env:
|
||||||
UNITY_LICENSE: ${{ secrets[matrix.license] }}
|
UNITY_LICENSE: ${{ secrets[matrix.license] }}
|
||||||
- run: /opt/Unity/Editor/Unity -quit -batchmode -nographics -silent-crashes -logFile -manualLicenseFile .Unity.ulf || exit 0
|
with:
|
||||||
|
projectPath: src/UniTask
|
||||||
# Execute scripts: Export Package
|
unityVersion: ${{ matrix.unity }}
|
||||||
- name: Export unitypackage
|
targetPlatform: StandaloneLinux64
|
||||||
run: /opt/Unity/Editor/Unity -quit -batchmode -nographics -silent-crashes -logFile -projectPath . -executeMethod PackageExporter.Export
|
buildMethod: PackageExporter.Export
|
||||||
working-directory: src/UniTask
|
versioning: None
|
||||||
|
|
||||||
- name: check all .meta is commited
|
- name: check all .meta is commited
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -259,3 +259,5 @@ src/UniTask/Unity.EditorCoroutines.Editor.csproj
|
|||||||
src/UniTask/.vsconfig
|
src/UniTask/.vsconfig
|
||||||
|
|
||||||
src/UniTask/Logs/ApiUpdaterCheck.txt
|
src/UniTask/Logs/ApiUpdaterCheck.txt
|
||||||
|
|
||||||
|
src/UniTask/Assembly-CSharp-firstpass.csproj
|
||||||
|
|||||||
136
README.md
136
README.md
@@ -24,6 +24,7 @@ For advanced tips, see blog post: [Extends UnityWebRequest via async decorator p
|
|||||||
- [Getting started](#getting-started)
|
- [Getting started](#getting-started)
|
||||||
- [Basics of UniTask and AsyncOperation](#basics-of-unitask-and-asyncoperation)
|
- [Basics of UniTask and AsyncOperation](#basics-of-unitask-and-asyncoperation)
|
||||||
- [Cancellation and Exception handling](#cancellation-and-exception-handling)
|
- [Cancellation and Exception handling](#cancellation-and-exception-handling)
|
||||||
|
- [Timeout handling](#timeout-handling)
|
||||||
- [Progress](#progress)
|
- [Progress](#progress)
|
||||||
- [PlayerLoop](#playerloop)
|
- [PlayerLoop](#playerloop)
|
||||||
- [async void vs async UniTaskVoid](#async-void-vs-async-unitaskvoid)
|
- [async void vs async UniTaskVoid](#async-void-vs-async-unitaskvoid)
|
||||||
@@ -127,9 +128,6 @@ async UniTask<string> DemoAsync()
|
|||||||
|
|
||||||
// shorthand of WhenAll, tuple can await directly
|
// shorthand of WhenAll, tuple can await directly
|
||||||
var (google2, bing2, yahoo2) = await (task1, task2, task3);
|
var (google2, bing2, yahoo2) = await (task1, task2, task3);
|
||||||
|
|
||||||
// You can handle timeouts easily
|
|
||||||
await GetTextAsync(UnityWebRequest.Get("http://unity.com")).Timeout(TimeSpan.FromMilliseconds(300));
|
|
||||||
|
|
||||||
// return async-value.(or you can use `UniTask`(no result), `UniTaskVoid`(fire and forget)).
|
// return async-value.(or you can use `UniTask`(no result), `UniTaskVoid`(fire and forget)).
|
||||||
return (asset as TextAsset)?.text ?? throw new InvalidOperationException("Asset not found");
|
return (asset as TextAsset)?.text ?? throw new InvalidOperationException("Asset not found");
|
||||||
@@ -154,7 +152,7 @@ UniTask provides three pattern of extension methods.
|
|||||||
|
|
||||||
`WithCancellation` is a simple version of `ToUniTask`, both return `UniTask`. For details of cancellation, see: [Cancellation and Exception handling](#cancellation-and-exception-handling) section.
|
`WithCancellation` is a simple version of `ToUniTask`, both return `UniTask`. For details of cancellation, see: [Cancellation and Exception handling](#cancellation-and-exception-handling) section.
|
||||||
|
|
||||||
> Note: WithCancellation is returned from native timing of PlayerLoop but ToUniTask is returned from specified PlayerLoopTiming. For details of timing, see: [PlayerLoop](#playerloop) section.
|
> Note: await directly is returned from native timing of PlayerLoop but WithCancellation and ToUniTask are returned from specified PlayerLoopTiming. For details of timing, see: [PlayerLoop](#playerloop) section.
|
||||||
|
|
||||||
> Note: AssetBundleRequest has `asset` and `allAssets`, default await returns `asset`. If you want to get `allAssets`, you can use `AwaitForAllAssets()` method.
|
> Note: AssetBundleRequest has `asset` and `allAssets`, default await returns `asset`. If you want to get `allAssets`, you can use `AwaitForAllAssets()` method.
|
||||||
|
|
||||||
@@ -286,6 +284,100 @@ if (isCanceled)
|
|||||||
|
|
||||||
Note: Only suppress throws if you call directly into the most source method. Otherwise, the return value will be converted, but the entire pipeline will not suppress throws.
|
Note: Only suppress throws if you call directly into the most source method. Otherwise, the return value will be converted, but the entire pipeline will not suppress throws.
|
||||||
|
|
||||||
|
Timeout handling
|
||||||
|
---
|
||||||
|
Timeout is a variation of cancellation. You can set timeout by `CancellationTokenSouce.CancelAfterSlim(TimeSpan)` and pass CancellationToken to async methods.
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
var cts = new CancellationTokenSource();
|
||||||
|
cts.CancelAfterSlim(TimeSpan.FromSeconds(5)); // 5sec timeout.
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await UnityWebRequest.Get("http://foo").SendWebRequest().WithCancellation(cts.Token);
|
||||||
|
}
|
||||||
|
catch (OperationCanceledException ex)
|
||||||
|
{
|
||||||
|
if (ex.CancellationToken == cts.Token)
|
||||||
|
{
|
||||||
|
UnityEngine.Debug.Log("Timeout");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
> `CancellationTokenSouce.CancelAfter` is a standard api. However in Unity you should not use it because it depends threading timer. `CancelAfterSlim` is UniTask's extension methods, it uses PlayerLoop instead.
|
||||||
|
|
||||||
|
If you want to use timeout with other source of cancellation, use `CancellationTokenSource.CreateLinkedTokenSource`.
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
var cancelToken = new CancellationTokenSource();
|
||||||
|
cancelButton.onClick.AddListener(()=>
|
||||||
|
{
|
||||||
|
cancelToken.Cancel(); // cancel from button click.
|
||||||
|
});
|
||||||
|
|
||||||
|
var timeoutToken = new CancellationTokenSource();
|
||||||
|
timeoutToken.CancelAfterSlim(TimeSpan.FromSeconds(5)); // 5sec timeout.
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// combine token
|
||||||
|
var linkedTokenSource = CancellationTokenSource.CreateLinkedTokenSource(cancelToken.Token, timeoutToken.Token);
|
||||||
|
|
||||||
|
await UnityWebRequest.Get("http://foo").SendWebRequest().WithCancellation(linkedTokenSource.Token);
|
||||||
|
}
|
||||||
|
catch (OperationCanceledException ex)
|
||||||
|
{
|
||||||
|
if (timeoutToken.IsCancellationRequested)
|
||||||
|
{
|
||||||
|
UnityEngine.Debug.Log("Timeout.");
|
||||||
|
}
|
||||||
|
else if (cancelToken.IsCancellationRequested)
|
||||||
|
{
|
||||||
|
UnityEngine.Debug.Log("Cancel clicked.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Optimize for reduce allocation of CancellationTokenSource for timeout per call async method, you can use UniTask's `TimeoutController`.
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
TimeoutController timeoutController = new TimeoutController(); // setup to field for reuse.
|
||||||
|
|
||||||
|
async UniTask FooAsync()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// you can pass timeoutController.Timeout(TimeSpan) to cancellationToken.
|
||||||
|
await UnityWebRequest.Get("http://foo").SendWebRequest()
|
||||||
|
.WithCancellation(timeoutController.Timeout(TimeSpan.FromSeconds(5)));
|
||||||
|
timeoutController.Reset(); // call Reset(Stop timeout timer and ready for reuse) when succeed.
|
||||||
|
}
|
||||||
|
catch (OperationCanceledException ex)
|
||||||
|
{
|
||||||
|
if (timeoutController.IsTimeout())
|
||||||
|
{
|
||||||
|
UnityEngine.Debug.Log("timeout");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
If you want to use timeout with other source of cancellation, use `new TimeoutController(CancellationToken)`.
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
TimeoutController timeoutController;
|
||||||
|
CancellationTokenSource clickCancelSource;
|
||||||
|
|
||||||
|
void Start()
|
||||||
|
{
|
||||||
|
this.clickCancelSource = new CancellationTokenSource();
|
||||||
|
this.timeoutController = new TimeoutController(clickCancelSource);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Note: UniTask has `.Timeout`, `.TimeoutWithoutException` methods however, if possible, do not use these, please pass `CancellationToken`. Because `.Timeout` work from external of task, can not stop timeoutted task. `.Timeout` means ignore result when timeout. If you pass a `CancellationToken` to the method, it will act from inside of the task, so it is possible to stop a running task.
|
||||||
|
|
||||||
Progress
|
Progress
|
||||||
---
|
---
|
||||||
Some async operations for unity have `ToUniTask(IProgress<float> progress = null, ...)` extension methods.
|
Some async operations for unity have `ToUniTask(IProgress<float> progress = null, ...)` extension methods.
|
||||||
@@ -366,7 +458,7 @@ It indicates when to run, you can check [PlayerLoopList.md](https://gist.github.
|
|||||||
|
|
||||||
`AsyncOperation` is returned from native timing. For example, await `SceneManager.LoadSceneAsync` is returned from `EarlyUpdate.UpdatePreloading` and after being called, the loaded scene's `Start` is called from `EarlyUpdate.ScriptRunDelayedStartupFrame`. Also `await UnityWebRequest` is returned from `EarlyUpdate.ExecuteMainThreadJobs`.
|
`AsyncOperation` is returned from native timing. For example, await `SceneManager.LoadSceneAsync` is returned from `EarlyUpdate.UpdatePreloading` and after being called, the loaded scene's `Start` is called from `EarlyUpdate.ScriptRunDelayedStartupFrame`. Also `await UnityWebRequest` is returned from `EarlyUpdate.ExecuteMainThreadJobs`.
|
||||||
|
|
||||||
In UniTask, await directly and `WithCancellation` use native timing, `ToUniTask` uses specified timing. This is usually not a particular problem, but with `LoadSceneAsync`, it causes a different order of Start and continuation after await. So it is recommended not to use `LoadSceneAsync.ToUniTask`.
|
In UniTask, await directly uses native timing, `WithCancellation` and `ToUniTask` use specified timing. This is usually not a particular problem, but with `LoadSceneAsync`, it causes a different order of Start and continuation after await. So it is recommended not to use `LoadSceneAsync.ToUniTask`.
|
||||||
|
|
||||||
In the stacktrace, you can check where it is running in playerloop.
|
In the stacktrace, you can check where it is running in playerloop.
|
||||||
|
|
||||||
@@ -408,6 +500,37 @@ void Start()
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
You can optimize loop cost slightly by remove unuse PlayerLoopTiming injection. You can call `PlayerLoopHelper.Initialize(InjectPlayerLoopTimings)` on initialize.
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
var loop = PlayerLoop.GetCurrentPlayerLoop();
|
||||||
|
PlayerLoopHelper.Initialize(ref loop, InjectPlayerLoopTimings.Minimum); // minimum is Update | FixedUpdate | LastPostLateUpdate
|
||||||
|
```
|
||||||
|
|
||||||
|
`InjectPlayerLoopTimings` has three preset, `All` and `Standard`(All without last except LastPostLateUpdate), `Minimum`(`Update | FixedUpdate | LastPostLateUpdate`). Default is All and you can combine custom inject timings like `InjectPlayerLoopTimings.Update | InjectPlayerLoopTimings.FixedUpdate | InjectPlayerLoopTimings.PreLateUpdate`.
|
||||||
|
|
||||||
|
You can make error to use uninjected `PlayerLoopTiming` by [Microsoft.CodeAnalysis.BannedApiAnalyzers](https://github.com/dotnet/roslyn-analyzers/blob/master/src/Microsoft.CodeAnalysis.BannedApiAnalyzers/BannedApiAnalyzers.Help.md). For example, you can setup `BannedSymbols.txt` like this for `InjectPlayerLoopTimings.Minimum`.
|
||||||
|
|
||||||
|
```txt
|
||||||
|
F:Cysharp.Threading.Tasks.PlayerLoopTiming.Initialization; Isn't injected this PlayerLoop in this project.
|
||||||
|
F:Cysharp.Threading.Tasks.PlayerLoopTiming.LastInitialization; Isn't injected this PlayerLoop in this project.
|
||||||
|
F:Cysharp.Threading.Tasks.PlayerLoopTiming.EarlyUpdate; Isn't injected this PlayerLoop in this project.
|
||||||
|
F:Cysharp.Threading.Tasks.PlayerLoopTiming.LastEarlyUpdate; Isn't injected this PlayerLoop in this project.d
|
||||||
|
F:Cysharp.Threading.Tasks.PlayerLoopTiming.LastFixedUpdate; Isn't injected this PlayerLoop in this project.
|
||||||
|
F:Cysharp.Threading.Tasks.PlayerLoopTiming.PreUpdate; Isn't injected this PlayerLoop in this project.
|
||||||
|
F:Cysharp.Threading.Tasks.PlayerLoopTiming.LastPreUpdate; Isn't injected this PlayerLoop in this project.
|
||||||
|
F:Cysharp.Threading.Tasks.PlayerLoopTiming.LastUpdate; Isn't injected this PlayerLoop in this project.
|
||||||
|
F:Cysharp.Threading.Tasks.PlayerLoopTiming.PreLateUpdate; Isn't injected this PlayerLoop in this project.
|
||||||
|
F:Cysharp.Threading.Tasks.PlayerLoopTiming.LastPreLateUpdate; Isn't injected this PlayerLoop in this project.
|
||||||
|
F:Cysharp.Threading.Tasks.PlayerLoopTiming.PostLateUpdate; Isn't injected this PlayerLoop in this project.
|
||||||
|
F:Cysharp.Threading.Tasks.PlayerLoopTiming.TimeUpdate; Isn't injected this PlayerLoop in this project.
|
||||||
|
F:Cysharp.Threading.Tasks.PlayerLoopTiming.LastTimeUpdate; Isn't injected this PlayerLoop in this project.
|
||||||
|
```
|
||||||
|
|
||||||
|
You can configure `RS0030` severity to error.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
async void vs async UniTaskVoid
|
async void vs async UniTaskVoid
|
||||||
---
|
---
|
||||||
`async void` is a standard C# task system so it does not run on UniTask systems. It is better not to use it. `async UniTaskVoid` is a lightweight version of `async UniTask` because it does not have awaitable completion and reports errors immediately to `UniTaskScheduler.UnobservedTaskException`. If you don't require awaiting (fire and forget), using `UniTaskVoid` is better. Unfortunately to dismiss warning, you're required to call `Forget()`.
|
`async void` is a standard C# task system so it does not run on UniTask systems. It is better not to use it. `async UniTaskVoid` is a lightweight version of `async UniTask` because it does not have awaitable completion and reports errors immediately to `UniTaskScheduler.UnobservedTaskException`. If you don't require awaiting (fire and forget), using `UniTaskVoid` is better. Unfortunately to dismiss warning, you're required to call `Forget()`.
|
||||||
@@ -812,8 +935,9 @@ For UnityEditor
|
|||||||
---
|
---
|
||||||
UniTask can run on Unity Editor like an Editor Coroutine. However, there are some limitations.
|
UniTask can run on Unity Editor like an Editor Coroutine. However, there are some limitations.
|
||||||
|
|
||||||
* Delay, DelayFrame do not work correctly because they can not get deltaTime in editor. Return the result of the await immediately; you can use `DelayType.Realtime` to wait for the right time.
|
* UniTask.Delay's DelayType.DeltaTime, UnscaledDeltaTime do not work correctly because they can not get deltaTime in editor. Therefore run on EditMode, automatically change DelayType to `DelayType.Realtime` that wait for the right time.
|
||||||
* All PlayerLoopTiming run on the timing `EditorApplication.update`.
|
* All PlayerLoopTiming run on the timing `EditorApplication.update`.
|
||||||
|
* `-batchmode` with `-quit` does not work because does not run `EditorApplication.update`(quit on single frame) so should not use `-quit` and quit manually with `Environment.Exit(0)`.
|
||||||
|
|
||||||
Compare with Standard Task API
|
Compare with Standard Task API
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -41,6 +41,7 @@
|
|||||||
..\UniTask\Assets\Plugins\UniTask\Runtime\UniTaskSynchronizationContext.cs;
|
..\UniTask\Assets\Plugins\UniTask\Runtime\UniTaskSynchronizationContext.cs;
|
||||||
..\UniTask\Assets\Plugins\UniTask\Runtime\CancellationTokenSourceExtensions.cs;
|
..\UniTask\Assets\Plugins\UniTask\Runtime\CancellationTokenSourceExtensions.cs;
|
||||||
..\UniTask\Assets\Plugins\UniTask\Runtime\EnumeratorAsyncExtensions.cs;
|
..\UniTask\Assets\Plugins\UniTask\Runtime\EnumeratorAsyncExtensions.cs;
|
||||||
|
..\UniTask\Assets\Plugins\UniTask\Runtime\TimeoutController.cs;
|
||||||
..\UniTask\Assets\Plugins\UniTask\Runtime\PlayerLoopHelper.cs;
|
..\UniTask\Assets\Plugins\UniTask\Runtime\PlayerLoopHelper.cs;
|
||||||
..\UniTask\Assets\Plugins\UniTask\Runtime\UniTask.Delay.cs;
|
..\UniTask\Assets\Plugins\UniTask\Runtime\UniTask.Delay.cs;
|
||||||
..\UniTask\Assets\Plugins\UniTask\Runtime\UniTask.Run.cs;
|
..\UniTask\Assets\Plugins\UniTask\Runtime\UniTask.Run.cs;
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ namespace NetCoreTests
|
|||||||
{
|
{
|
||||||
CancellationTokenSource cts = new CancellationTokenSource();
|
CancellationTokenSource cts = new CancellationTokenSource();
|
||||||
|
|
||||||
var v = await UniTask.Run(() => 10).WithCancellation(cts.Token);
|
var v = await UniTask.Run(() => 10).AttachExternalCancellation(cts.Token);
|
||||||
|
|
||||||
v.Should().Be(10);
|
v.Should().Be(10);
|
||||||
}
|
}
|
||||||
@@ -30,7 +30,7 @@ namespace NetCoreTests
|
|||||||
{
|
{
|
||||||
await Task.Delay(TimeSpan.FromSeconds(1));
|
await Task.Delay(TimeSpan.FromSeconds(1));
|
||||||
return 10;
|
return 10;
|
||||||
}).WithCancellation(cts.Token);
|
}).AttachExternalCancellation(cts.Token);
|
||||||
|
|
||||||
cts.Cancel();
|
cts.Cancel();
|
||||||
|
|
||||||
|
|||||||
@@ -1,734 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<PropertyGroup>
|
|
||||||
<LangVersion>latest</LangVersion>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup>
|
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
|
||||||
<ProductVersion>10.0.20506</ProductVersion>
|
|
||||||
<SchemaVersion>2.0</SchemaVersion>
|
|
||||||
<RootNamespace></RootNamespace>
|
|
||||||
<ProjectGuid>{CECB0124-DA37-D676-2B9E-00C5241684F4}</ProjectGuid>
|
|
||||||
<OutputType>Library</OutputType>
|
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
|
||||||
<AssemblyName>Assembly-CSharp-firstpass</AssemblyName>
|
|
||||||
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
|
|
||||||
<FileAlignment>512</FileAlignment>
|
|
||||||
<BaseDirectory>.</BaseDirectory>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
|
||||||
<DebugSymbols>true</DebugSymbols>
|
|
||||||
<DebugType>full</DebugType>
|
|
||||||
<Optimize>false</Optimize>
|
|
||||||
<OutputPath>Temp\Bin\Debug\</OutputPath>
|
|
||||||
<DefineConstants>DEBUG;TRACE;UNITY_2020_2_1;UNITY_2020_2;UNITY_2020;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;UNITY_2019_3_OR_NEWER;UNITY_2019_4_OR_NEWER;UNITY_2020_1_OR_NEWER;UNITY_2020_2_OR_NEWER;PLATFORM_ARCH_64;UNITY_64;UNITY_INCLUDE_TESTS;USE_SEARCH_ENGINE_API;SCENE_TEMPLATE_MODULE;ENABLE_AR;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_EVENT_QUEUE;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_TEXTURE_STREAMING;ENABLE_VIRTUALTEXTURING;ENABLE_UNET;ENABLE_LZMA;ENABLE_UNITYEVENTS;ENABLE_VR;ENABLE_WEBCAM;ENABLE_UNITYWEBREQUEST;ENABLE_WWW;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_COLLAB;ENABLE_CLOUD_SERVICES_COLLAB_SOFTLOCKS;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_SERVICES_USE_WEBREQUEST;ENABLE_CLOUD_SERVICES_CRASH_REPORTING;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_ANALYTICS;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;PLATFORM_STANDALONE_WIN;UNITY_STANDALONE_WIN;UNITY_STANDALONE;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_OUT_OF_PROCESS_CRASH_HANDLER;ENABLE_CLUSTER_SYNC;ENABLE_CLUSTERINPUT;PLATFORM_UPDATES_TIME_OUTSIDE_OF_PLAYER_LOOP;GFXDEVICE_WAITFOREVENT_MESSAGEPUMP;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;UNITY_PRO_LICENSE;ENABLE_CUSTOM_RENDER_TEXTURE;ENABLE_DIRECTOR;ENABLE_LOCALIZATION;ENABLE_SPRITES;ENABLE_TERRAIN;ENABLE_TILEMAP;ENABLE_TIMELINE;ENABLE_LEGACY_INPUT_MANAGER;CSHARP_7_OR_LATER;CSHARP_7_3_OR_NEWER</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
<NoWarn>0169</NoWarn>
|
|
||||||
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
|
||||||
<DebugType>pdbonly</DebugType>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
<OutputPath>Temp\bin\Release\</OutputPath>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
<NoWarn>0169</NoWarn>
|
|
||||||
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup>
|
|
||||||
<NoConfig>true</NoConfig>
|
|
||||||
<NoStdLib>true</NoStdLib>
|
|
||||||
<AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>
|
|
||||||
<ImplicitlyExpandNETStandardFacades>false</ImplicitlyExpandNETStandardFacades>
|
|
||||||
<ImplicitlyExpandDesignTimeFacades>false</ImplicitlyExpandDesignTimeFacades>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup>
|
|
||||||
<ProjectTypeGuids>{E097FAD1-6243-4DAD-9C02-E9B9EFC3FFC1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
|
||||||
<UnityProjectGenerator>Package</UnityProjectGenerator>
|
|
||||||
<UnityProjectGeneratorVersion>2.0.5</UnityProjectGeneratorVersion>
|
|
||||||
<UnityProjectType>GamePlugins:3</UnityProjectType>
|
|
||||||
<UnityBuildTarget>StandaloneWindows64:19</UnityBuildTarget>
|
|
||||||
<UnityVersion>2020.2.1f1</UnityVersion>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Analyzer Include="C:\Program Files (x86)\Microsoft Visual Studio Tools for Unity\16.0\Analyzers\Microsoft.Unity.Analyzers.dll" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\CompilerServices\AsyncUniTaskMethodBuilder.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\UniTask.Bridge.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\EnumerableAsyncExtensions.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\Internal\Error.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\Channel.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\IUniTaskSource.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\Progress.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\Internal\PooledDelegate.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\UniTask.WhenAny.Generated.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\UnityAsyncExtensions.uGUI.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\UnityAsyncExtensions.MonoBehaviour.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\UniTaskCompletionSource.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\Internal\DiagnosticsExtensions.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\CompilerServices\AsyncMethodBuilderAttribute.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\Triggers\AsyncAwakeTrigger.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\CompilerServices\AsyncUniTaskVoidMethodBuilder.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\UnityAsyncExtensions.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\IUniTaskAsyncEnumerable.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\CancellationTokenSourceExtensions.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\_InternalVisibleTo.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\AsyncUnit.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\Internal\RuntimeHelpersAbstraction.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\TriggerEvent.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\UniTask.Threading.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\UniTaskVoid.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\TaskPool.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\UnityBindingExtensions.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\Triggers\AsyncTriggerBase.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\UnityWebRequestException.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\Internal\WeakDictionary.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\UniTask.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\UniTaskSynchronizationContext.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\Internal\ArrayPool.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\Triggers\AsyncStartTrigger.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\UniTaskExtensions.Shorthand.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\UniTask.Delay.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\UniTaskScheduler.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\UniTask.WhenAll.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\UniTask.Factory.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\Internal\ValueStopwatch.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\Internal\ContinuationQueue.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\EnumeratorAsyncExtensions.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\UnityAsyncExtensions.AssetBundleRequestAllAssets.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\Internal\PlayerLoopRunner.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\UniTask.WaitUntil.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\UniTask.Run.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\Internal\ArrayUtil.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\MoveNextSource.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\Triggers\MonoBehaviourMessagesTriggers.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\ExceptionExtensions.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\AsyncReactiveProperty.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\AsyncLazy.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\UniTask.WhenAny.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\PlayerLoopHelper.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\Internal\MinimumQueue.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\UniTask.WhenAll.Generated.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\CompilerServices\StateMachineRunner.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\Internal\StatePool.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\UnityAsyncExtensions.AsyncGPUReadback.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\UnityAsyncExtensions.Jobs.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\UniTaskObservableExtensions.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\UniTaskExtensions.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\Triggers\AsyncTriggerExtensions.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\CancellationTokenExtensions.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\Internal\ArrayPoolUtil.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\Internal\TaskTracker.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\Triggers\AsyncDestroyTrigger.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\Internal\UnityEqualityComparer.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\Internal\UnityWebRequestExtensions.cs" />
|
|
||||||
<Compile Include="Assets\Plugins\UniTask\Runtime\CancellationTokenEqualityComparer.cs" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="Assets\Plugins\UniTask\Runtime\UniTask.asmdef" />
|
|
||||||
<Reference Include="UnityEngine">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.AIModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.AIModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.ARModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.ARModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.AccessibilityModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.AccessibilityModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.AndroidJNIModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.AndroidJNIModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.AnimationModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.AnimationModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.AssetBundleModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.AssetBundleModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.AudioModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.AudioModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.ClusterInputModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.ClusterInputModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.ClusterRendererModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.ClusterRendererModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.CoreModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.CrashReportingModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.CrashReportingModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.DSPGraphModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.DSPGraphModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.DirectorModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.DirectorModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.GIModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.GIModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.GameCenterModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.GameCenterModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.GridModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.GridModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.HotReloadModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.HotReloadModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.IMGUIModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.IMGUIModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.ImageConversionModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.ImageConversionModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.InputModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.InputModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.InputLegacyModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.InputLegacyModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.JSONSerializeModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.JSONSerializeModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.LocalizationModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.LocalizationModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.ParticleSystemModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.ParticleSystemModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.PerformanceReportingModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.PerformanceReportingModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.ProfilerModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.ProfilerModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.RuntimeInitializeOnLoadManagerInitializerModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.RuntimeInitializeOnLoadManagerInitializerModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.ScreenCaptureModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.ScreenCaptureModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.SharedInternalsModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.SharedInternalsModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.SpriteMaskModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.SpriteMaskModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.SpriteShapeModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.SpriteShapeModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.StreamingModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.StreamingModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.SubstanceModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.SubstanceModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.TLSModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.TLSModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.TerrainModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.TerrainModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.TextCoreModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.TextCoreModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.TextRenderingModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.TextRenderingModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.UIModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.UIModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.UIElementsModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.UIElementsModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.UIElementsNativeModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.UIElementsNativeModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.UNETModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.UNETModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.UmbraModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.UmbraModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.UnityAnalyticsModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.UnityAnalyticsModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.UnityConnectModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.UnityConnectModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.UnityCurlModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.UnityCurlModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.UnityTestProtocolModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.UnityTestProtocolModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.UnityWebRequestModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.UnityWebRequestModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.UnityWebRequestAssetBundleModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.UnityWebRequestAssetBundleModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.UnityWebRequestAudioModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.UnityWebRequestAudioModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.UnityWebRequestTextureModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.UnityWebRequestTextureModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.UnityWebRequestWWWModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.UnityWebRequestWWWModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.VFXModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.VFXModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.VideoModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.VideoModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.VirtualTexturingModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.VirtualTexturingModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.WindModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEngine.WindModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEditor">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEditor.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEditor.CoreModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEditor.CoreModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEditor.GraphViewModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEditor.GraphViewModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEditor.PackageManagerUIModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEditor.PackageManagerUIModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEditor.SceneTemplateModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEditor.SceneTemplateModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEditor.UIElementsModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEditor.UIElementsModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEditor.UIElementsSamplesModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEditor.UIElementsSamplesModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEditor.UIServiceModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEditor.UIServiceModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEditor.UnityConnectModule">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\Managed\UnityEngine\UnityEditor.UnityConnectModule.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="nunit.framework">
|
|
||||||
<HintPath>Library\PackageCache\com.unity.ext.nunit@1.0.5\net35\unity-custom\nunit.framework.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="netstandard">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\ref\2.0.0\netstandard.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Microsoft.Win32.Primitives">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\Microsoft.Win32.Primitives.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.AppContext">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.AppContext.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Collections.Concurrent">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Collections.Concurrent.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Collections">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Collections.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Collections.NonGeneric">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Collections.NonGeneric.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Collections.Specialized">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Collections.Specialized.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.ComponentModel">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.ComponentModel.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.ComponentModel.EventBasedAsync">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.ComponentModel.EventBasedAsync.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.ComponentModel.Primitives">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.ComponentModel.Primitives.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.ComponentModel.TypeConverter">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.ComponentModel.TypeConverter.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Console">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Console.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Data.Common">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Data.Common.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Diagnostics.Contracts">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Diagnostics.Contracts.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Diagnostics.Debug">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Diagnostics.Debug.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Diagnostics.FileVersionInfo">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Diagnostics.FileVersionInfo.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Diagnostics.Process">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Diagnostics.Process.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Diagnostics.StackTrace">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Diagnostics.StackTrace.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Diagnostics.TextWriterTraceListener">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Diagnostics.TextWriterTraceListener.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Diagnostics.Tools">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Diagnostics.Tools.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Diagnostics.TraceSource">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Diagnostics.TraceSource.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Diagnostics.Tracing">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Diagnostics.Tracing.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Drawing.Primitives">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Drawing.Primitives.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Dynamic.Runtime">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Dynamic.Runtime.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Globalization.Calendars">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Globalization.Calendars.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Globalization">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Globalization.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Globalization.Extensions">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Globalization.Extensions.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.IO.Compression">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.IO.Compression.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.IO.Compression.ZipFile">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.IO.Compression.ZipFile.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.IO">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.IO.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.IO.FileSystem">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.IO.FileSystem.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.IO.FileSystem.DriveInfo">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.IO.FileSystem.DriveInfo.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.IO.FileSystem.Primitives">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.IO.FileSystem.Primitives.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.IO.FileSystem.Watcher">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.IO.FileSystem.Watcher.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.IO.IsolatedStorage">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.IO.IsolatedStorage.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.IO.MemoryMappedFiles">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.IO.MemoryMappedFiles.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.IO.Pipes">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.IO.Pipes.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.IO.UnmanagedMemoryStream">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.IO.UnmanagedMemoryStream.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Linq">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Linq.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Linq.Expressions">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Linq.Expressions.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Linq.Parallel">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Linq.Parallel.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Linq.Queryable">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Linq.Queryable.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Net.Http">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Net.Http.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Net.NameResolution">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Net.NameResolution.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Net.NetworkInformation">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Net.NetworkInformation.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Net.Ping">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Net.Ping.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Net.Primitives">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Net.Primitives.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Net.Requests">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Net.Requests.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Net.Security">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Net.Security.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Net.Sockets">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Net.Sockets.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Net.WebHeaderCollection">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Net.WebHeaderCollection.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Net.WebSockets.Client">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Net.WebSockets.Client.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Net.WebSockets">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Net.WebSockets.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.ObjectModel">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.ObjectModel.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Reflection">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Reflection.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Reflection.Extensions">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Reflection.Extensions.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Reflection.Primitives">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Reflection.Primitives.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Resources.Reader">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Resources.Reader.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Resources.ResourceManager">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Resources.ResourceManager.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Resources.Writer">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Resources.Writer.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Runtime.CompilerServices.VisualC">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Runtime.CompilerServices.VisualC.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Runtime">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Runtime.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Runtime.Extensions">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Runtime.Extensions.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Runtime.Handles">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Runtime.Handles.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Runtime.InteropServices">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Runtime.InteropServices.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Runtime.InteropServices.RuntimeInformation">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Runtime.InteropServices.RuntimeInformation.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Runtime.Numerics">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Runtime.Numerics.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Runtime.Serialization.Formatters">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Runtime.Serialization.Formatters.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Runtime.Serialization.Json">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Runtime.Serialization.Json.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Runtime.Serialization.Primitives">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Runtime.Serialization.Primitives.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Runtime.Serialization.Xml">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Runtime.Serialization.Xml.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Security.Claims">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Security.Claims.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Security.Cryptography.Algorithms">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Security.Cryptography.Algorithms.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Security.Cryptography.Csp">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Security.Cryptography.Csp.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Security.Cryptography.Encoding">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Security.Cryptography.Encoding.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Security.Cryptography.Primitives">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Security.Cryptography.Primitives.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Security.Cryptography.X509Certificates">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Security.Cryptography.X509Certificates.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Security.Principal">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Security.Principal.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Security.SecureString">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Security.SecureString.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Text.Encoding">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Text.Encoding.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Text.Encoding.Extensions">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Text.Encoding.Extensions.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Text.RegularExpressions">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Text.RegularExpressions.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Threading">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Threading.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Threading.Overlapped">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Threading.Overlapped.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Threading.Tasks">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Threading.Tasks.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Threading.Tasks.Parallel">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Threading.Tasks.Parallel.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Threading.Thread">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Threading.Thread.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Threading.ThreadPool">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Threading.ThreadPool.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Threading.Timer">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Threading.Timer.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.ValueTuple">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.ValueTuple.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Xml.ReaderWriter">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Xml.ReaderWriter.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Xml.XDocument">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Xml.XDocument.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Xml.XmlDocument">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Xml.XmlDocument.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Xml.XmlSerializer">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Xml.XmlSerializer.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Xml.XPath">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Xml.XPath.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Xml.XPath.XDocument">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netstandard\System.Xml.XPath.XDocument.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Numerics.Vectors">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\Extensions\2.0.0\System.Numerics.Vectors.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Runtime.InteropServices.WindowsRuntime">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\Extensions\2.0.0\System.Runtime.InteropServices.WindowsRuntime.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="mscorlib">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netfx\mscorlib.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.ComponentModel.Composition">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netfx\System.ComponentModel.Composition.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Core">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netfx\System.Core.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Data">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netfx\System.Data.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netfx\System.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Drawing">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netfx\System.Drawing.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.IO.Compression.FileSystem">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netfx\System.IO.Compression.FileSystem.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Net">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netfx\System.Net.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Numerics">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netfx\System.Numerics.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Runtime.Serialization">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netfx\System.Runtime.Serialization.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.ServiceModel.Web">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netfx\System.ServiceModel.Web.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Transactions">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netfx\System.Transactions.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Web">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netfx\System.Web.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Windows">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netfx\System.Windows.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Xml">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netfx\System.Xml.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Xml.Linq">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netfx\System.Xml.Linq.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Xml.Serialization">
|
|
||||||
<HintPath>C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Data\NetStandard\compat\2.0.0\shims\netfx\System.Xml.Serialization.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Unity.VSCode.Editor">
|
|
||||||
<HintPath>Library\ScriptAssemblies\Unity.VSCode.Editor.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEditor.CacheServer">
|
|
||||||
<HintPath>Library\ScriptAssemblies\UnityEditor.CacheServer.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Unity.VisualStudio.Editor">
|
|
||||||
<HintPath>Library\ScriptAssemblies\Unity.VisualStudio.Editor.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Unity.Addressables">
|
|
||||||
<HintPath>Library\ScriptAssemblies\Unity.Addressables.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Unity.ScriptableBuildPipeline">
|
|
||||||
<HintPath>Library\ScriptAssemblies\Unity.ScriptableBuildPipeline.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Unity.Addressables.Editor">
|
|
||||||
<HintPath>Library\ScriptAssemblies\Unity.Addressables.Editor.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Unity.ScriptableBuildPipeline.Editor">
|
|
||||||
<HintPath>Library\ScriptAssemblies\Unity.ScriptableBuildPipeline.Editor.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Unity.ResourceManager">
|
|
||||||
<HintPath>Library\ScriptAssemblies\Unity.ResourceManager.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Unity.Rider.Editor">
|
|
||||||
<HintPath>Library\ScriptAssemblies\Unity.Rider.Editor.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="UniTask.TextMeshPro.csproj">
|
|
||||||
<Project>{B5929667-6CB2-8779-D894-4F69110C1A43}</Project>
|
|
||||||
<Name>UniTask.TextMeshPro</Name>
|
|
||||||
</ProjectReference>
|
|
||||||
<ProjectReference Include="TempAsm.csproj">
|
|
||||||
<Project>{9E0EF10C-B6E1-E08E-3160-7162D66F7EE0}</Project>
|
|
||||||
<Name>TempAsm</Name>
|
|
||||||
</ProjectReference>
|
|
||||||
<ProjectReference Include="UniTask.DOTween.csproj">
|
|
||||||
<Project>{7121D833-D063-D143-CFFC-CD50DDF1B3D1}</Project>
|
|
||||||
<Name>UniTask.DOTween</Name>
|
|
||||||
</ProjectReference>
|
|
||||||
<ProjectReference Include="UniTask.Addressables.csproj">
|
|
||||||
<Project>{78124C71-0355-1FB9-3AEB-7D573CD8E7CA}</Project>
|
|
||||||
<Name>UniTask.Addressables</Name>
|
|
||||||
</ProjectReference>
|
|
||||||
<ProjectReference Include="UniTask.Linq.csproj">
|
|
||||||
<Project>{7F0F67EA-D985-C15F-AAE8-F643789B52A7}</Project>
|
|
||||||
<Name>UniTask.Linq</Name>
|
|
||||||
</ProjectReference>
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
|
||||||
<Target Name="GenerateTargetFrameworkMonikerAttribute" />
|
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
|
||||||
<Target Name="BeforeBuild">
|
|
||||||
</Target>
|
|
||||||
<Target Name="AfterBuild">
|
|
||||||
</Target>
|
|
||||||
-->
|
|
||||||
</Project>
|
|
||||||
@@ -7,6 +7,7 @@ using System;
|
|||||||
|
|
||||||
namespace Cysharp.Threading.Tasks
|
namespace Cysharp.Threading.Tasks
|
||||||
{
|
{
|
||||||
|
|
||||||
public static class CancellationTokenSourceExtensions
|
public static class CancellationTokenSourceExtensions
|
||||||
{
|
{
|
||||||
public static void CancelAfterSlim(this CancellationTokenSource cts, int millisecondsDelay, DelayType delayType = DelayType.DeltaTime, PlayerLoopTiming delayTiming = PlayerLoopTiming.Update)
|
public static void CancelAfterSlim(this CancellationTokenSource cts, int millisecondsDelay, DelayType delayType = DelayType.DeltaTime, PlayerLoopTiming delayTiming = PlayerLoopTiming.Update)
|
||||||
|
|||||||
@@ -98,6 +98,79 @@ namespace Cysharp.Threading.Tasks
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Flags]
|
||||||
|
public enum InjectPlayerLoopTimings
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Preset: All loops(default).
|
||||||
|
/// </summary>
|
||||||
|
All =
|
||||||
|
Initialization | LastInitialization |
|
||||||
|
EarlyUpdate | LastEarlyUpdate |
|
||||||
|
FixedUpdate | LastFixedUpdate |
|
||||||
|
PreUpdate | LastPreUpdate |
|
||||||
|
Update | LastUpdate |
|
||||||
|
PreLateUpdate | LastPreLateUpdate |
|
||||||
|
PostLateUpdate | LastPostLateUpdate
|
||||||
|
#if UNITY_2020_2_OR_NEWER
|
||||||
|
| TimeUpdate | LastTimeUpdate,
|
||||||
|
#else
|
||||||
|
,
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Preset: All without last except LastPostLateUpdate.
|
||||||
|
/// </summary>
|
||||||
|
Standard =
|
||||||
|
Initialization |
|
||||||
|
EarlyUpdate |
|
||||||
|
FixedUpdate |
|
||||||
|
PreUpdate |
|
||||||
|
Update |
|
||||||
|
PreLateUpdate |
|
||||||
|
PostLateUpdate | LastPostLateUpdate
|
||||||
|
#if UNITY_2020_2_OR_NEWER
|
||||||
|
| TimeUpdate
|
||||||
|
#endif
|
||||||
|
,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Preset: Minimum pattern, Update | FixedUpdate | LastPostLateUpdate
|
||||||
|
/// </summary>
|
||||||
|
Minimum =
|
||||||
|
Update | FixedUpdate | LastPostLateUpdate,
|
||||||
|
|
||||||
|
// PlayerLoopTiming
|
||||||
|
|
||||||
|
Initialization = 1,
|
||||||
|
LastInitialization = 2,
|
||||||
|
|
||||||
|
EarlyUpdate = 4,
|
||||||
|
LastEarlyUpdate = 8,
|
||||||
|
|
||||||
|
FixedUpdate = 16,
|
||||||
|
LastFixedUpdate = 32,
|
||||||
|
|
||||||
|
PreUpdate = 64,
|
||||||
|
LastPreUpdate = 128,
|
||||||
|
|
||||||
|
Update = 256,
|
||||||
|
LastUpdate = 512,
|
||||||
|
|
||||||
|
PreLateUpdate = 1024,
|
||||||
|
LastPreLateUpdate = 2048,
|
||||||
|
|
||||||
|
PostLateUpdate = 4096,
|
||||||
|
LastPostLateUpdate = 8192
|
||||||
|
|
||||||
|
#if UNITY_2020_2_OR_NEWER
|
||||||
|
,
|
||||||
|
// Unity 2020.2 added TimeUpdate https://docs.unity3d.com/2020.2/Documentation/ScriptReference/PlayerLoop.TimeUpdate.html
|
||||||
|
TimeUpdate = 16384,
|
||||||
|
LastTimeUpdate = 32768
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
public interface IPlayerLoopItem
|
public interface IPlayerLoopItem
|
||||||
{
|
{
|
||||||
bool MoveNext();
|
bool MoveNext();
|
||||||
@@ -105,6 +178,9 @@ namespace Cysharp.Threading.Tasks
|
|||||||
|
|
||||||
public static class PlayerLoopHelper
|
public static class PlayerLoopHelper
|
||||||
{
|
{
|
||||||
|
static readonly ContinuationQueue ThrowMarkerContinuationQueue = new ContinuationQueue(PlayerLoopTiming.Initialization);
|
||||||
|
static readonly PlayerLoopRunner ThrowMarkerPlayerLoopRunner = new PlayerLoopRunner(PlayerLoopTiming.Initialization);
|
||||||
|
|
||||||
public static SynchronizationContext UnitySynchronizationContext => unitySynchronizationContetext;
|
public static SynchronizationContext UnitySynchronizationContext => unitySynchronizationContetext;
|
||||||
public static int MainThreadId => mainThreadId;
|
public static int MainThreadId => mainThreadId;
|
||||||
internal static string ApplicationDataPath => applicationDataPath;
|
internal static string ApplicationDataPath => applicationDataPath;
|
||||||
@@ -118,8 +194,9 @@ namespace Cysharp.Threading.Tasks
|
|||||||
static PlayerLoopRunner[] runners;
|
static PlayerLoopRunner[] runners;
|
||||||
internal static bool IsEditorApplicationQuitting { get; private set; }
|
internal static bool IsEditorApplicationQuitting { get; private set; }
|
||||||
static PlayerLoopSystem[] InsertRunner(PlayerLoopSystem loopSystem,
|
static PlayerLoopSystem[] InsertRunner(PlayerLoopSystem loopSystem,
|
||||||
Type loopRunnerYieldType, ContinuationQueue cq, Type lastLoopRunnerYieldType, ContinuationQueue lastCq,
|
bool injectOnFirst,
|
||||||
Type loopRunnerType, PlayerLoopRunner runner, Type lastLoopRunnerType, PlayerLoopRunner lastRunner)
|
Type loopRunnerYieldType, ContinuationQueue cq,
|
||||||
|
Type loopRunnerType, PlayerLoopRunner runner)
|
||||||
{
|
{
|
||||||
|
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
@@ -134,22 +211,11 @@ namespace Cysharp.Threading.Tasks
|
|||||||
runner.Run();
|
runner.Run();
|
||||||
runner.Clear();
|
runner.Clear();
|
||||||
}
|
}
|
||||||
if (lastRunner != null)
|
|
||||||
{
|
|
||||||
lastRunner.Run();
|
|
||||||
lastRunner.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cq != null)
|
if (cq != null)
|
||||||
{
|
{
|
||||||
cq.Run();
|
cq.Run();
|
||||||
cq.Clear();
|
cq.Clear();
|
||||||
}
|
}
|
||||||
if (lastCq != null)
|
|
||||||
{
|
|
||||||
lastCq.Run();
|
|
||||||
lastCq.Clear();
|
|
||||||
}
|
|
||||||
IsEditorApplicationQuitting = false;
|
IsEditorApplicationQuitting = false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -161,40 +227,38 @@ namespace Cysharp.Threading.Tasks
|
|||||||
updateDelegate = cq.Run
|
updateDelegate = cq.Run
|
||||||
};
|
};
|
||||||
|
|
||||||
var lastYieldLoop = new PlayerLoopSystem
|
|
||||||
{
|
|
||||||
type = lastLoopRunnerYieldType,
|
|
||||||
updateDelegate = lastCq.Run
|
|
||||||
};
|
|
||||||
|
|
||||||
var runnerLoop = new PlayerLoopSystem
|
var runnerLoop = new PlayerLoopSystem
|
||||||
{
|
{
|
||||||
type = loopRunnerType,
|
type = loopRunnerType,
|
||||||
updateDelegate = runner.Run
|
updateDelegate = runner.Run
|
||||||
};
|
};
|
||||||
|
|
||||||
var lastRunnerLoop = new PlayerLoopSystem
|
|
||||||
{
|
|
||||||
type = lastLoopRunnerType,
|
|
||||||
updateDelegate = lastRunner.Run
|
|
||||||
};
|
|
||||||
|
|
||||||
// Remove items from previous initializations.
|
// Remove items from previous initializations.
|
||||||
var source = loopSystem.subSystemList
|
var source = RemoveRunner(loopSystem, loopRunnerYieldType, loopRunnerType);
|
||||||
.Where(ls => ls.type != loopRunnerYieldType && ls.type != loopRunnerType && ls.type != lastLoopRunnerYieldType && ls.type != lastLoopRunnerType)
|
var dest = new PlayerLoopSystem[source.Length + 2];
|
||||||
.ToArray();
|
|
||||||
|
|
||||||
var dest = new PlayerLoopSystem[source.Length + 4];
|
Array.Copy(source, 0, dest, injectOnFirst ? 2 : 0, source.Length);
|
||||||
|
if (injectOnFirst)
|
||||||
Array.Copy(source, 0, dest, 2, source.Length);
|
{
|
||||||
dest[0] = yieldLoop;
|
dest[0] = yieldLoop;
|
||||||
dest[1] = runnerLoop;
|
dest[1] = runnerLoop;
|
||||||
dest[dest.Length - 2] = lastYieldLoop;
|
}
|
||||||
dest[dest.Length - 1] = lastRunnerLoop;
|
else
|
||||||
|
{
|
||||||
|
dest[dest.Length - 2] = yieldLoop;
|
||||||
|
dest[dest.Length - 1] = runnerLoop;
|
||||||
|
}
|
||||||
|
|
||||||
return dest;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PlayerLoopSystem[] RemoveRunner(PlayerLoopSystem loopSystem, Type loopRunnerYieldType, Type loopRunnerType)
|
||||||
|
{
|
||||||
|
return loopSystem.subSystemList
|
||||||
|
.Where(ls => ls.type != loopRunnerYieldType && ls.type != loopRunnerType)
|
||||||
|
.ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
static PlayerLoopSystem[] InsertUniTaskSynchronizationContext(PlayerLoopSystem loopSystem)
|
static PlayerLoopSystem[] InsertUniTaskSynchronizationContext(PlayerLoopSystem loopSystem)
|
||||||
{
|
{
|
||||||
var loop = new PlayerLoopSystem
|
var loop = new PlayerLoopSystem
|
||||||
@@ -311,7 +375,23 @@ namespace Cysharp.Threading.Tasks
|
|||||||
throw new Exception("Target PlayerLoopSystem does not found. Type:" + systemType.FullName);
|
throw new Exception("Target PlayerLoopSystem does not found. Type:" + systemType.FullName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Initialize(ref PlayerLoopSystem playerLoop)
|
static void InsertLoop(PlayerLoopSystem[] copyList, InjectPlayerLoopTimings injectTimings, Type loopType, InjectPlayerLoopTimings targetTimings,
|
||||||
|
int index, bool injectOnFirst, Type loopRunnerYieldType, Type loopRunnerType, PlayerLoopTiming playerLoopTiming)
|
||||||
|
{
|
||||||
|
var i = FindLoopSystemIndex(copyList, loopType);
|
||||||
|
if ((injectTimings & targetTimings) == targetTimings)
|
||||||
|
{
|
||||||
|
copyList[i].subSystemList = InsertRunner(copyList[i], injectOnFirst,
|
||||||
|
loopRunnerYieldType, yielders[index] = new ContinuationQueue(playerLoopTiming),
|
||||||
|
loopRunnerType, runners[index] = new PlayerLoopRunner(playerLoopTiming));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
copyList[i].subSystemList = RemoveRunner(copyList[i], loopRunnerYieldType, loopRunnerType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Initialize(ref PlayerLoopSystem playerLoop, InjectPlayerLoopTimings injectTimings = InjectPlayerLoopTimings.All)
|
||||||
{
|
{
|
||||||
#if UNITY_2020_2_OR_NEWER
|
#if UNITY_2020_2_OR_NEWER
|
||||||
yielders = new ContinuationQueue[16];
|
yielders = new ContinuationQueue[16];
|
||||||
@@ -323,58 +403,82 @@ namespace Cysharp.Threading.Tasks
|
|||||||
|
|
||||||
var copyList = playerLoop.subSystemList.ToArray();
|
var copyList = playerLoop.subSystemList.ToArray();
|
||||||
|
|
||||||
var i = FindLoopSystemIndex(copyList, typeof(PlayerLoopType.Initialization));
|
// Initialization
|
||||||
copyList[i].subSystemList = InsertRunner(copyList[i], typeof(UniTaskLoopRunners.UniTaskLoopRunnerYieldInitialization), yielders[0] = new ContinuationQueue(PlayerLoopTiming.Initialization),
|
InsertLoop(copyList, injectTimings, typeof(PlayerLoopType.Initialization),
|
||||||
typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastYieldInitialization), yielders[1] = new ContinuationQueue(PlayerLoopTiming.LastInitialization),
|
InjectPlayerLoopTimings.Initialization, 0, true,
|
||||||
typeof(UniTaskLoopRunners.UniTaskLoopRunnerInitialization), runners[0] = new PlayerLoopRunner(PlayerLoopTiming.Initialization),
|
typeof(UniTaskLoopRunners.UniTaskLoopRunnerYieldInitialization), typeof(UniTaskLoopRunners.UniTaskLoopRunnerInitialization), PlayerLoopTiming.Initialization);
|
||||||
typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastInitialization), runners[1] = new PlayerLoopRunner(PlayerLoopTiming.LastInitialization));
|
|
||||||
|
InsertLoop(copyList, injectTimings, typeof(PlayerLoopType.Initialization),
|
||||||
|
InjectPlayerLoopTimings.LastInitialization, 1, false,
|
||||||
|
typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastYieldInitialization), typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastInitialization), PlayerLoopTiming.LastInitialization);
|
||||||
|
|
||||||
// EarlyUpdate
|
// EarlyUpdate
|
||||||
i = FindLoopSystemIndex(copyList, typeof(PlayerLoopType.EarlyUpdate));
|
InsertLoop(copyList, injectTimings, typeof(PlayerLoopType.EarlyUpdate),
|
||||||
copyList[i].subSystemList = InsertRunner(copyList[i], typeof(UniTaskLoopRunners.UniTaskLoopRunnerYieldEarlyUpdate), yielders[2] = new ContinuationQueue(PlayerLoopTiming.EarlyUpdate),
|
InjectPlayerLoopTimings.EarlyUpdate, 2, true,
|
||||||
typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastYieldEarlyUpdate), yielders[3] = new ContinuationQueue(PlayerLoopTiming.LastEarlyUpdate),
|
typeof(UniTaskLoopRunners.UniTaskLoopRunnerYieldEarlyUpdate), typeof(UniTaskLoopRunners.UniTaskLoopRunnerEarlyUpdate), PlayerLoopTiming.EarlyUpdate);
|
||||||
typeof(UniTaskLoopRunners.UniTaskLoopRunnerEarlyUpdate), runners[2] = new PlayerLoopRunner(PlayerLoopTiming.EarlyUpdate),
|
|
||||||
typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastEarlyUpdate), runners[3] = new PlayerLoopRunner(PlayerLoopTiming.LastEarlyUpdate));
|
InsertLoop(copyList, injectTimings, typeof(PlayerLoopType.EarlyUpdate),
|
||||||
|
InjectPlayerLoopTimings.LastEarlyUpdate, 3, false,
|
||||||
|
typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastYieldEarlyUpdate), typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastEarlyUpdate), PlayerLoopTiming.LastEarlyUpdate);
|
||||||
|
|
||||||
// FixedUpdate
|
// FixedUpdate
|
||||||
i = FindLoopSystemIndex(copyList, typeof(PlayerLoopType.FixedUpdate));
|
InsertLoop(copyList, injectTimings, typeof(PlayerLoopType.FixedUpdate),
|
||||||
copyList[i].subSystemList = InsertRunner(copyList[i], typeof(UniTaskLoopRunners.UniTaskLoopRunnerYieldFixedUpdate), yielders[4] = new ContinuationQueue(PlayerLoopTiming.FixedUpdate),
|
InjectPlayerLoopTimings.FixedUpdate, 4, true,
|
||||||
typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastYieldFixedUpdate), yielders[5] = new ContinuationQueue(PlayerLoopTiming.LastFixedUpdate),
|
typeof(UniTaskLoopRunners.UniTaskLoopRunnerYieldFixedUpdate), typeof(UniTaskLoopRunners.UniTaskLoopRunnerFixedUpdate), PlayerLoopTiming.FixedUpdate);
|
||||||
typeof(UniTaskLoopRunners.UniTaskLoopRunnerFixedUpdate), runners[4] = new PlayerLoopRunner(PlayerLoopTiming.FixedUpdate),
|
|
||||||
typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastFixedUpdate), runners[5] = new PlayerLoopRunner(PlayerLoopTiming.LastFixedUpdate));
|
InsertLoop(copyList, injectTimings, typeof(PlayerLoopType.FixedUpdate),
|
||||||
|
InjectPlayerLoopTimings.LastFixedUpdate, 5, false,
|
||||||
|
typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastYieldFixedUpdate), typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastFixedUpdate), PlayerLoopTiming.LastFixedUpdate);
|
||||||
|
|
||||||
// PreUpdate
|
// PreUpdate
|
||||||
i = FindLoopSystemIndex(copyList, typeof(PlayerLoopType.PreUpdate));
|
InsertLoop(copyList, injectTimings, typeof(PlayerLoopType.PreUpdate),
|
||||||
copyList[i].subSystemList = InsertRunner(copyList[i], typeof(UniTaskLoopRunners.UniTaskLoopRunnerYieldPreUpdate), yielders[6] = new ContinuationQueue(PlayerLoopTiming.PreUpdate),
|
InjectPlayerLoopTimings.PreUpdate, 6, true,
|
||||||
typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastYieldPreUpdate), yielders[7] = new ContinuationQueue(PlayerLoopTiming.LastPreUpdate),
|
typeof(UniTaskLoopRunners.UniTaskLoopRunnerYieldPreUpdate), typeof(UniTaskLoopRunners.UniTaskLoopRunnerPreUpdate), PlayerLoopTiming.PreUpdate);
|
||||||
typeof(UniTaskLoopRunners.UniTaskLoopRunnerPreUpdate), runners[6] = new PlayerLoopRunner(PlayerLoopTiming.PreUpdate),
|
|
||||||
typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastPreUpdate), runners[7] = new PlayerLoopRunner(PlayerLoopTiming.LastPreUpdate));
|
InsertLoop(copyList, injectTimings, typeof(PlayerLoopType.PreUpdate),
|
||||||
|
InjectPlayerLoopTimings.LastPreUpdate, 7, false,
|
||||||
|
typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastYieldPreUpdate), typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastPreUpdate), PlayerLoopTiming.LastPreUpdate);
|
||||||
|
|
||||||
// Update
|
// Update
|
||||||
i = FindLoopSystemIndex(copyList, typeof(PlayerLoopType.Update));
|
InsertLoop(copyList, injectTimings, typeof(PlayerLoopType.Update),
|
||||||
copyList[i].subSystemList = InsertRunner(copyList[i], typeof(UniTaskLoopRunners.UniTaskLoopRunnerYieldUpdate), yielders[8] = new ContinuationQueue(PlayerLoopTiming.Update),
|
InjectPlayerLoopTimings.Update, 8, true,
|
||||||
typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastYieldUpdate), yielders[9] = new ContinuationQueue(PlayerLoopTiming.LastUpdate),
|
typeof(UniTaskLoopRunners.UniTaskLoopRunnerYieldUpdate), typeof(UniTaskLoopRunners.UniTaskLoopRunnerUpdate), PlayerLoopTiming.Update);
|
||||||
typeof(UniTaskLoopRunners.UniTaskLoopRunnerUpdate), runners[8] = new PlayerLoopRunner(PlayerLoopTiming.Update),
|
|
||||||
typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastUpdate), runners[9] = new PlayerLoopRunner(PlayerLoopTiming.LastUpdate));
|
InsertLoop(copyList, injectTimings, typeof(PlayerLoopType.Update),
|
||||||
|
InjectPlayerLoopTimings.LastUpdate, 9, false,
|
||||||
|
typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastYieldUpdate), typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastUpdate), PlayerLoopTiming.LastUpdate);
|
||||||
|
|
||||||
// PreLateUpdate
|
// PreLateUpdate
|
||||||
i = FindLoopSystemIndex(copyList, typeof(PlayerLoopType.PreLateUpdate));
|
InsertLoop(copyList, injectTimings, typeof(PlayerLoopType.PreLateUpdate),
|
||||||
copyList[i].subSystemList = InsertRunner(copyList[i], typeof(UniTaskLoopRunners.UniTaskLoopRunnerYieldPreLateUpdate), yielders[10] = new ContinuationQueue(PlayerLoopTiming.PreLateUpdate),
|
InjectPlayerLoopTimings.PreLateUpdate, 10, true,
|
||||||
typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastYieldPreLateUpdate), yielders[11] = new ContinuationQueue(PlayerLoopTiming.LastPreLateUpdate),
|
typeof(UniTaskLoopRunners.UniTaskLoopRunnerYieldPreLateUpdate), typeof(UniTaskLoopRunners.UniTaskLoopRunnerPreLateUpdate), PlayerLoopTiming.PreLateUpdate);
|
||||||
typeof(UniTaskLoopRunners.UniTaskLoopRunnerPreLateUpdate), runners[10] = new PlayerLoopRunner(PlayerLoopTiming.PreLateUpdate),
|
|
||||||
typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastPreLateUpdate), runners[11] = new PlayerLoopRunner(PlayerLoopTiming.LastPreLateUpdate));
|
InsertLoop(copyList, injectTimings, typeof(PlayerLoopType.PreLateUpdate),
|
||||||
|
InjectPlayerLoopTimings.LastPreLateUpdate, 11, false,
|
||||||
|
typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastYieldPreLateUpdate), typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastPreLateUpdate), PlayerLoopTiming.LastPreLateUpdate);
|
||||||
|
|
||||||
// PostLateUpdate
|
// PostLateUpdate
|
||||||
i = FindLoopSystemIndex(copyList, typeof(PlayerLoopType.PostLateUpdate));
|
InsertLoop(copyList, injectTimings, typeof(PlayerLoopType.PostLateUpdate),
|
||||||
copyList[i].subSystemList = InsertRunner(copyList[i], typeof(UniTaskLoopRunners.UniTaskLoopRunnerYieldPostLateUpdate), yielders[12] = new ContinuationQueue(PlayerLoopTiming.PostLateUpdate),
|
InjectPlayerLoopTimings.PostLateUpdate, 12, true,
|
||||||
typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastYieldPostLateUpdate), yielders[13] = new ContinuationQueue(PlayerLoopTiming.LastPostLateUpdate),
|
typeof(UniTaskLoopRunners.UniTaskLoopRunnerYieldPostLateUpdate), typeof(UniTaskLoopRunners.UniTaskLoopRunnerPostLateUpdate), PlayerLoopTiming.PostLateUpdate);
|
||||||
typeof(UniTaskLoopRunners.UniTaskLoopRunnerPostLateUpdate), runners[12] = new PlayerLoopRunner(PlayerLoopTiming.PostLateUpdate),
|
|
||||||
typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastPostLateUpdate), runners[13] = new PlayerLoopRunner(PlayerLoopTiming.LastPostLateUpdate));
|
InsertLoop(copyList, injectTimings, typeof(PlayerLoopType.PostLateUpdate),
|
||||||
|
InjectPlayerLoopTimings.LastPostLateUpdate, 13, false,
|
||||||
|
typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastYieldPostLateUpdate), typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastPostLateUpdate), PlayerLoopTiming.LastPostLateUpdate);
|
||||||
|
|
||||||
#if UNITY_2020_2_OR_NEWER
|
#if UNITY_2020_2_OR_NEWER
|
||||||
// TimeUpdate
|
// TimeUpdate
|
||||||
i = FindLoopSystemIndex(copyList, typeof(PlayerLoopType.TimeUpdate));
|
InsertLoop(copyList, injectTimings, typeof(PlayerLoopType.TimeUpdate),
|
||||||
copyList[i].subSystemList = InsertRunner(copyList[i], typeof(UniTaskLoopRunners.UniTaskLoopRunnerYieldTimeUpdate), yielders[14] = new ContinuationQueue(PlayerLoopTiming.TimeUpdate),
|
InjectPlayerLoopTimings.TimeUpdate, 14, true,
|
||||||
typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastYieldTimeUpdate), yielders[15] = new ContinuationQueue(PlayerLoopTiming.LastTimeUpdate),
|
typeof(UniTaskLoopRunners.UniTaskLoopRunnerYieldTimeUpdate), typeof(UniTaskLoopRunners.UniTaskLoopRunnerTimeUpdate), PlayerLoopTiming.TimeUpdate);
|
||||||
typeof(UniTaskLoopRunners.UniTaskLoopRunnerTimeUpdate), runners[14] = new PlayerLoopRunner(PlayerLoopTiming.TimeUpdate),
|
|
||||||
typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastTimeUpdate), runners[15] = new PlayerLoopRunner(PlayerLoopTiming.LastTimeUpdate));
|
InsertLoop(copyList, injectTimings, typeof(PlayerLoopType.TimeUpdate),
|
||||||
|
InjectPlayerLoopTimings.LastTimeUpdate, 15, false,
|
||||||
|
typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastYieldTimeUpdate), typeof(UniTaskLoopRunners.UniTaskLoopRunnerLastTimeUpdate), PlayerLoopTiming.LastTimeUpdate);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Insert UniTaskSynchronizationContext to Update loop
|
// Insert UniTaskSynchronizationContext to Update loop
|
||||||
i = FindLoopSystemIndex(copyList, typeof(PlayerLoopType.Update));
|
var i = FindLoopSystemIndex(copyList, typeof(PlayerLoopType.Update));
|
||||||
copyList[i].subSystemList = InsertUniTaskSynchronizationContext(copyList[i]);
|
copyList[i].subSystemList = InsertUniTaskSynchronizationContext(copyList[i]);
|
||||||
|
|
||||||
playerLoop.subSystemList = copyList;
|
playerLoop.subSystemList = copyList;
|
||||||
@@ -383,12 +487,27 @@ namespace Cysharp.Threading.Tasks
|
|||||||
|
|
||||||
public static void AddAction(PlayerLoopTiming timing, IPlayerLoopItem action)
|
public static void AddAction(PlayerLoopTiming timing, IPlayerLoopItem action)
|
||||||
{
|
{
|
||||||
runners[(int)timing].AddAction(action);
|
var runner = runners[(int)timing];
|
||||||
|
if (runner == null)
|
||||||
|
{
|
||||||
|
ThrowInvalidLoopTiming(timing);
|
||||||
|
}
|
||||||
|
runner.AddAction(action);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ThrowInvalidLoopTiming(PlayerLoopTiming playerLoopTiming)
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException("Target playerLoopTiming is not injected. Please check PlayerLoopHelper.Initialize. PlayerLoopTiming:" + playerLoopTiming);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void AddContinuation(PlayerLoopTiming timing, Action continuation)
|
public static void AddContinuation(PlayerLoopTiming timing, Action continuation)
|
||||||
{
|
{
|
||||||
yielders[(int)timing].Enqueue(continuation);
|
var q = yielders[(int)timing];
|
||||||
|
if (q == null)
|
||||||
|
{
|
||||||
|
ThrowInvalidLoopTiming(timing);
|
||||||
|
}
|
||||||
|
q.Enqueue(continuation);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Diagnostics helper
|
// Diagnostics helper
|
||||||
|
|||||||
258
src/UniTask/Assets/Plugins/UniTask/Runtime/TimeoutController.cs
Normal file
258
src/UniTask/Assets/Plugins/UniTask/Runtime/TimeoutController.cs
Normal file
@@ -0,0 +1,258 @@
|
|||||||
|
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
|
||||||
|
|
||||||
|
using System.Threading;
|
||||||
|
using System;
|
||||||
|
using Cysharp.Threading.Tasks.Internal;
|
||||||
|
|
||||||
|
namespace Cysharp.Threading.Tasks
|
||||||
|
{
|
||||||
|
// CancellationTokenSource itself can not reuse but CancelAfter(Timeout.InfiniteTimeSpan) allows reuse if did not reach timeout.
|
||||||
|
// Similar discussion:
|
||||||
|
// https://github.com/dotnet/runtime/issues/4694
|
||||||
|
// https://github.com/dotnet/runtime/issues/48492
|
||||||
|
// This TimeoutController emulate similar implementation, using CancelAfterSlim; to achieve zero allocation timeout.
|
||||||
|
|
||||||
|
public sealed class TimeoutController : IDisposable
|
||||||
|
{
|
||||||
|
CancellationTokenSource timeoutSource;
|
||||||
|
CancellationTokenSource linkedSource;
|
||||||
|
StoppableDelayRealtimePromise timeoutDelay;
|
||||||
|
|
||||||
|
readonly CancellationTokenSource originalLinkCancellationTokenSource;
|
||||||
|
|
||||||
|
public TimeoutController()
|
||||||
|
{
|
||||||
|
this.timeoutSource = new CancellationTokenSource();
|
||||||
|
this.originalLinkCancellationTokenSource = null;
|
||||||
|
this.linkedSource = null;
|
||||||
|
this.timeoutDelay = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TimeoutController(CancellationTokenSource linkCancellationTokenSource)
|
||||||
|
{
|
||||||
|
this.timeoutSource = new CancellationTokenSource();
|
||||||
|
this.originalLinkCancellationTokenSource = linkCancellationTokenSource;
|
||||||
|
this.linkedSource = CancellationTokenSource.CreateLinkedTokenSource(timeoutSource.Token, linkCancellationTokenSource.Token);
|
||||||
|
this.timeoutDelay = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CancellationToken Timeout(TimeSpan timeout)
|
||||||
|
{
|
||||||
|
if (originalLinkCancellationTokenSource != null && originalLinkCancellationTokenSource.IsCancellationRequested)
|
||||||
|
{
|
||||||
|
return originalLinkCancellationTokenSource.Token;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (timeoutSource.IsCancellationRequested)
|
||||||
|
{
|
||||||
|
timeoutSource.Dispose();
|
||||||
|
timeoutSource = new CancellationTokenSource();
|
||||||
|
if (linkedSource != null)
|
||||||
|
{
|
||||||
|
this.linkedSource.Cancel();
|
||||||
|
this.linkedSource.Dispose();
|
||||||
|
this.linkedSource = CancellationTokenSource.CreateLinkedTokenSource(timeoutSource.Token, originalLinkCancellationTokenSource.Token);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (timeoutDelay == null)
|
||||||
|
{
|
||||||
|
RunDelayAsync(timeout).Forget(); // timeoutDelay = ... in RunDelayAsync(immediately, before await)
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
timeoutDelay.RestartStopwatch(); // already running RunDelayAsync
|
||||||
|
}
|
||||||
|
|
||||||
|
return (linkedSource != null) ? linkedSource.Token : timeoutSource.Token;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsTimeout()
|
||||||
|
{
|
||||||
|
return timeoutSource.IsCancellationRequested;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Reset()
|
||||||
|
{
|
||||||
|
if (timeoutDelay != null)
|
||||||
|
{
|
||||||
|
timeoutDelay.Stop(); // stop delay, will finish RunDelayAsync
|
||||||
|
timeoutDelay = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async UniTaskVoid RunDelayAsync(TimeSpan timeout)
|
||||||
|
{
|
||||||
|
timeoutDelay = StoppableDelayRealtimePromise.Create(timeout, PlayerLoopTiming.Update, (linkedSource == null) ? CancellationToken.None : linkedSource.Token, out var version);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var reason = await new UniTask<DelayResult>(timeoutDelay, version);
|
||||||
|
if (reason == DelayResult.DelayCompleted)
|
||||||
|
{
|
||||||
|
// UnityEngine.Debug.Log("DEBUG:Timeout Complete, try to call timeoutSource.Cancel");
|
||||||
|
timeoutSource.Cancel();
|
||||||
|
}
|
||||||
|
else if (reason == DelayResult.LinkedTokenCanceled)
|
||||||
|
{
|
||||||
|
// UnityEngine.Debug.Log("DEBUG:LinkedSource IsCancellationRequested");
|
||||||
|
}
|
||||||
|
else if (reason == DelayResult.ExternalStopped)
|
||||||
|
{
|
||||||
|
// Reset(Promise.Stop) called, do nothing.
|
||||||
|
// UnityEngine.Debug.Log("DEBUG:Reset called");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
timeoutDelay = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
if (timeoutDelay != null)
|
||||||
|
{
|
||||||
|
timeoutDelay.Stop();
|
||||||
|
}
|
||||||
|
timeoutSource.Dispose();
|
||||||
|
if (linkedSource != null)
|
||||||
|
{
|
||||||
|
linkedSource.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
enum DelayResult
|
||||||
|
{
|
||||||
|
LinkedTokenCanceled,
|
||||||
|
ExternalStopped,
|
||||||
|
DelayCompleted, // as Timeout.
|
||||||
|
}
|
||||||
|
|
||||||
|
// Stop + SuppressCancellationThrow.
|
||||||
|
sealed class StoppableDelayRealtimePromise : IUniTaskSource<DelayResult>, IPlayerLoopItem, ITaskPoolNode<StoppableDelayRealtimePromise>
|
||||||
|
{
|
||||||
|
static OperationCanceledException ExterenalStopException = new OperationCanceledException();
|
||||||
|
|
||||||
|
static TaskPool<StoppableDelayRealtimePromise> pool;
|
||||||
|
StoppableDelayRealtimePromise nextNode;
|
||||||
|
public ref StoppableDelayRealtimePromise NextNode => ref nextNode;
|
||||||
|
|
||||||
|
static StoppableDelayRealtimePromise()
|
||||||
|
{
|
||||||
|
TaskPool.RegisterSizeGetter(typeof(StoppableDelayRealtimePromise), () => pool.Size);
|
||||||
|
}
|
||||||
|
|
||||||
|
long delayTimeSpanTicks;
|
||||||
|
ValueStopwatch stopwatch;
|
||||||
|
CancellationToken cancellationToken;
|
||||||
|
bool externalStop;
|
||||||
|
|
||||||
|
UniTaskCompletionSourceCore<DelayResult> core;
|
||||||
|
|
||||||
|
StoppableDelayRealtimePromise()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public static StoppableDelayRealtimePromise Create(TimeSpan delayTimeSpan, PlayerLoopTiming timing, CancellationToken cancellationToken, out short token)
|
||||||
|
{
|
||||||
|
if (!pool.TryPop(out var result))
|
||||||
|
{
|
||||||
|
result = new StoppableDelayRealtimePromise();
|
||||||
|
}
|
||||||
|
|
||||||
|
result.stopwatch = ValueStopwatch.StartNew();
|
||||||
|
result.delayTimeSpanTicks = delayTimeSpan.Ticks;
|
||||||
|
result.cancellationToken = cancellationToken;
|
||||||
|
result.externalStop = false;
|
||||||
|
|
||||||
|
TaskTracker.TrackActiveTask(result, 3);
|
||||||
|
|
||||||
|
PlayerLoopHelper.AddAction(timing, result);
|
||||||
|
|
||||||
|
token = result.core.Version;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Stop()
|
||||||
|
{
|
||||||
|
externalStop = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RestartStopwatch()
|
||||||
|
{
|
||||||
|
stopwatch = ValueStopwatch.StartNew();
|
||||||
|
}
|
||||||
|
|
||||||
|
public DelayResult GetResult(short token)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return core.GetResult(token);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
TryReturn();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void IUniTaskSource.GetResult(short token)
|
||||||
|
{
|
||||||
|
GetResult(token);
|
||||||
|
}
|
||||||
|
|
||||||
|
public UniTaskStatus GetStatus(short token)
|
||||||
|
{
|
||||||
|
return core.GetStatus(token);
|
||||||
|
}
|
||||||
|
|
||||||
|
public UniTaskStatus UnsafeGetStatus()
|
||||||
|
{
|
||||||
|
return core.UnsafeGetStatus();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnCompleted(Action<object> continuation, object state, short token)
|
||||||
|
{
|
||||||
|
core.OnCompleted(continuation, state, token);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool MoveNext()
|
||||||
|
{
|
||||||
|
if (cancellationToken.IsCancellationRequested)
|
||||||
|
{
|
||||||
|
core.TrySetResult(DelayResult.LinkedTokenCanceled);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (externalStop)
|
||||||
|
{
|
||||||
|
core.TrySetResult(DelayResult.ExternalStopped);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stopwatch.IsInvalid)
|
||||||
|
{
|
||||||
|
core.TrySetResult(DelayResult.DelayCompleted);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stopwatch.ElapsedTicks >= delayTimeSpanTicks)
|
||||||
|
{
|
||||||
|
core.TrySetResult(DelayResult.DelayCompleted);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TryReturn()
|
||||||
|
{
|
||||||
|
TaskTracker.RemoveTracking(this);
|
||||||
|
core.Reset();
|
||||||
|
stopwatch = default;
|
||||||
|
cancellationToken = default;
|
||||||
|
externalStop = false;
|
||||||
|
return pool.TryPush(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 6347ab34d2db6d744a654e8d62d96b96
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -20,12 +20,23 @@ namespace Cysharp.Threading.Tasks
|
|||||||
|
|
||||||
public partial struct UniTask
|
public partial struct UniTask
|
||||||
{
|
{
|
||||||
public static YieldAwaitable Yield(PlayerLoopTiming timing = PlayerLoopTiming.Update)
|
public static YieldAwaitable Yield()
|
||||||
|
{
|
||||||
|
// optimized for single continuation
|
||||||
|
return new YieldAwaitable(PlayerLoopTiming.Update);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static YieldAwaitable Yield(PlayerLoopTiming timing)
|
||||||
{
|
{
|
||||||
// optimized for single continuation
|
// optimized for single continuation
|
||||||
return new YieldAwaitable(timing);
|
return new YieldAwaitable(timing);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static UniTask Yield(CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
return new UniTask(YieldPromise.Create(PlayerLoopTiming.Update, cancellationToken, out var token), token);
|
||||||
|
}
|
||||||
|
|
||||||
public static UniTask Yield(PlayerLoopTiming timing, CancellationToken cancellationToken)
|
public static UniTask Yield(PlayerLoopTiming timing, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
return new UniTask(YieldPromise.Create(timing, cancellationToken, out var token), token);
|
return new UniTask(YieldPromise.Create(timing, cancellationToken, out var token), token);
|
||||||
@@ -34,11 +45,36 @@ namespace Cysharp.Threading.Tasks
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Similar as UniTask.Yield but guaranteed run on next frame.
|
/// Similar as UniTask.Yield but guaranteed run on next frame.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static UniTask NextFrame(PlayerLoopTiming timing = PlayerLoopTiming.Update, CancellationToken cancellationToken = default)
|
public static UniTask NextFrame()
|
||||||
|
{
|
||||||
|
return new UniTask(NextFramePromise.Create(PlayerLoopTiming.Update, CancellationToken.None, out var token), token);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Similar as UniTask.Yield but guaranteed run on next frame.
|
||||||
|
/// </summary>
|
||||||
|
public static UniTask NextFrame(PlayerLoopTiming timing)
|
||||||
|
{
|
||||||
|
return new UniTask(NextFramePromise.Create(timing, CancellationToken.None, out var token), token);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Similar as UniTask.Yield but guaranteed run on next frame.
|
||||||
|
/// </summary>
|
||||||
|
public static UniTask NextFrame(CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
return new UniTask(NextFramePromise.Create(PlayerLoopTiming.Update, cancellationToken, out var token), token);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Similar as UniTask.Yield but guaranteed run on next frame.
|
||||||
|
/// </summary>
|
||||||
|
public static UniTask NextFrame(PlayerLoopTiming timing, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
return new UniTask(NextFramePromise.Create(timing, cancellationToken, out var token), token);
|
return new UniTask(NextFramePromise.Create(timing, cancellationToken, out var token), token);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Same as UniTask.Yield(PlayerLoopTiming.LastPostLateUpdate).
|
/// Same as UniTask.Yield(PlayerLoopTiming.LastPostLateUpdate).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -106,6 +142,14 @@ namespace Cysharp.Threading.Tasks
|
|||||||
throw new ArgumentOutOfRangeException("Delay does not allow minus delayTimeSpan. delayTimeSpan:" + delayTimeSpan);
|
throw new ArgumentOutOfRangeException("Delay does not allow minus delayTimeSpan. delayTimeSpan:" + delayTimeSpan);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
// force use Realtime.
|
||||||
|
if (PlayerLoopHelper.IsMainThread && !UnityEditor.EditorApplication.isPlaying)
|
||||||
|
{
|
||||||
|
delayType = DelayType.Realtime;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
switch (delayType)
|
switch (delayType)
|
||||||
{
|
{
|
||||||
case DelayType.UnscaledDeltaTime:
|
case DelayType.UnscaledDeltaTime:
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
"define": "UNITASK_UGUI_SUPPORT"
|
"define": "UNITASK_UGUI_SUPPORT"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "com.unity.modules.unitywebrequestwww",
|
"name": "com.unity.modules.unitywebrequest",
|
||||||
"expression": "",
|
"expression": "",
|
||||||
"define": "UNITASK_WEBREQUEST_SUPPORT"
|
"define": "UNITASK_WEBREQUEST_SUPPORT"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ namespace Cysharp.Threading.Tasks
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Ignore task result when cancel raised first.
|
/// Ignore task result when cancel raised first.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static UniTask WithCancellation(this UniTask task, CancellationToken cancellationToken)
|
public static UniTask AttachExternalCancellation(this UniTask task, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
if (!cancellationToken.CanBeCanceled)
|
if (!cancellationToken.CanBeCanceled)
|
||||||
{
|
{
|
||||||
@@ -209,13 +209,13 @@ namespace Cysharp.Threading.Tasks
|
|||||||
return task;
|
return task;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new UniTask(new WithCancellationSource(task, cancellationToken), 0);
|
return new UniTask(new AttachExternalCancellationSource(task, cancellationToken), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Ignore task result when cancel raised first.
|
/// Ignore task result when cancel raised first.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static UniTask<T> WithCancellation<T>(this UniTask<T> task, CancellationToken cancellationToken)
|
public static UniTask<T> AttachExternalCancellation<T>(this UniTask<T> task, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
if (!cancellationToken.CanBeCanceled)
|
if (!cancellationToken.CanBeCanceled)
|
||||||
{
|
{
|
||||||
@@ -232,10 +232,10 @@ namespace Cysharp.Threading.Tasks
|
|||||||
return task;
|
return task;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new UniTask<T>(new WithCancellationSource<T>(task, cancellationToken), 0);
|
return new UniTask<T>(new AttachExternalCancellationSource<T>(task, cancellationToken), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
sealed class WithCancellationSource : IUniTaskSource
|
sealed class AttachExternalCancellationSource : IUniTaskSource
|
||||||
{
|
{
|
||||||
static readonly Action<object> cancellationCallbackDelegate = CancellationCallback;
|
static readonly Action<object> cancellationCallbackDelegate = CancellationCallback;
|
||||||
|
|
||||||
@@ -243,7 +243,7 @@ namespace Cysharp.Threading.Tasks
|
|||||||
CancellationTokenRegistration tokenRegistration;
|
CancellationTokenRegistration tokenRegistration;
|
||||||
UniTaskCompletionSourceCore<AsyncUnit> core;
|
UniTaskCompletionSourceCore<AsyncUnit> core;
|
||||||
|
|
||||||
public WithCancellationSource(UniTask task, CancellationToken cancellationToken)
|
public AttachExternalCancellationSource(UniTask task, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
this.cancellationToken = cancellationToken;
|
this.cancellationToken = cancellationToken;
|
||||||
this.tokenRegistration = cancellationToken.RegisterWithoutCaptureExecutionContext(cancellationCallbackDelegate, this);
|
this.tokenRegistration = cancellationToken.RegisterWithoutCaptureExecutionContext(cancellationCallbackDelegate, this);
|
||||||
@@ -269,7 +269,7 @@ namespace Cysharp.Threading.Tasks
|
|||||||
|
|
||||||
static void CancellationCallback(object state)
|
static void CancellationCallback(object state)
|
||||||
{
|
{
|
||||||
var self = (WithCancellationSource)state;
|
var self = (AttachExternalCancellationSource)state;
|
||||||
self.core.TrySetCanceled(self.cancellationToken);
|
self.core.TrySetCanceled(self.cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -294,7 +294,7 @@ namespace Cysharp.Threading.Tasks
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sealed class WithCancellationSource<T> : IUniTaskSource<T>
|
sealed class AttachExternalCancellationSource<T> : IUniTaskSource<T>
|
||||||
{
|
{
|
||||||
static readonly Action<object> cancellationCallbackDelegate = CancellationCallback;
|
static readonly Action<object> cancellationCallbackDelegate = CancellationCallback;
|
||||||
|
|
||||||
@@ -302,7 +302,7 @@ namespace Cysharp.Threading.Tasks
|
|||||||
CancellationTokenRegistration tokenRegistration;
|
CancellationTokenRegistration tokenRegistration;
|
||||||
UniTaskCompletionSourceCore<T> core;
|
UniTaskCompletionSourceCore<T> core;
|
||||||
|
|
||||||
public WithCancellationSource(UniTask<T> task, CancellationToken cancellationToken)
|
public AttachExternalCancellationSource(UniTask<T> task, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
this.cancellationToken = cancellationToken;
|
this.cancellationToken = cancellationToken;
|
||||||
this.tokenRegistration = cancellationToken.RegisterWithoutCaptureExecutionContext(cancellationCallbackDelegate, this);
|
this.tokenRegistration = cancellationToken.RegisterWithoutCaptureExecutionContext(cancellationCallbackDelegate, this);
|
||||||
@@ -327,7 +327,7 @@ namespace Cysharp.Threading.Tasks
|
|||||||
|
|
||||||
static void CancellationCallback(object state)
|
static void CancellationCallback(object state)
|
||||||
{
|
{
|
||||||
var self = (WithCancellationSource<T>)state;
|
var self = (AttachExternalCancellationSource<T>)state;
|
||||||
self.core.TrySetCanceled(self.cancellationToken);
|
self.core.TrySetCanceled(self.cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,10 +21,7 @@ namespace Cysharp.Threading.Tasks
|
|||||||
|
|
||||||
public static UniTask<UnityEngine.Object[]> AwaitForAllAssets(this AssetBundleRequest asyncOperation, CancellationToken cancellationToken)
|
public static UniTask<UnityEngine.Object[]> AwaitForAllAssets(this AssetBundleRequest asyncOperation, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
Error.ThrowArgumentNullException(asyncOperation, nameof(asyncOperation));
|
return AwaitForAllAssets(asyncOperation, cancellationToken: cancellationToken);
|
||||||
if (cancellationToken.IsCancellationRequested) return UniTask.FromCanceled<UnityEngine.Object[]>(cancellationToken);
|
|
||||||
if (asyncOperation.isDone) return UniTask.FromResult<UnityEngine.Object[]>(asyncOperation.allAssets);
|
|
||||||
return new UniTask<UnityEngine.Object[]>(AssetBundleRequestAllAssetsWithCancellationSource.Create(asyncOperation, cancellationToken, out var token), token);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static UniTask<UnityEngine.Object[]> AwaitForAllAssets(this AssetBundleRequest asyncOperation, IProgress<float> progress = null, PlayerLoopTiming timing = PlayerLoopTiming.Update, CancellationToken cancellationToken = default(CancellationToken))
|
public static UniTask<UnityEngine.Object[]> AwaitForAllAssets(this AssetBundleRequest asyncOperation, IProgress<float> progress = null, PlayerLoopTiming timing = PlayerLoopTiming.Update, CancellationToken cancellationToken = default(CancellationToken))
|
||||||
@@ -84,129 +81,6 @@ namespace Cysharp.Threading.Tasks
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sealed class AssetBundleRequestAllAssetsWithCancellationSource : IUniTaskSource<UnityEngine.Object[]>, IPlayerLoopItem, ITaskPoolNode<AssetBundleRequestAllAssetsWithCancellationSource>
|
|
||||||
{
|
|
||||||
static TaskPool<AssetBundleRequestAllAssetsWithCancellationSource> pool;
|
|
||||||
AssetBundleRequestAllAssetsWithCancellationSource nextNode;
|
|
||||||
public ref AssetBundleRequestAllAssetsWithCancellationSource NextNode => ref nextNode;
|
|
||||||
|
|
||||||
static AssetBundleRequestAllAssetsWithCancellationSource()
|
|
||||||
{
|
|
||||||
TaskPool.RegisterSizeGetter(typeof(AssetBundleRequestAllAssetsWithCancellationSource), () => pool.Size);
|
|
||||||
}
|
|
||||||
|
|
||||||
readonly Action<AsyncOperation> continuationAction;
|
|
||||||
AssetBundleRequest asyncOperation;
|
|
||||||
CancellationToken cancellationToken;
|
|
||||||
bool completed;
|
|
||||||
|
|
||||||
UniTaskCompletionSourceCore<UnityEngine.Object[]> core;
|
|
||||||
|
|
||||||
AssetBundleRequestAllAssetsWithCancellationSource()
|
|
||||||
{
|
|
||||||
continuationAction = Continuation;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IUniTaskSource<UnityEngine.Object[]> Create(AssetBundleRequest asyncOperation, CancellationToken cancellationToken, out short token)
|
|
||||||
{
|
|
||||||
if (cancellationToken.IsCancellationRequested)
|
|
||||||
{
|
|
||||||
return AutoResetUniTaskCompletionSource<UnityEngine.Object[]>.CreateFromCanceled(cancellationToken, out token);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!pool.TryPop(out var result))
|
|
||||||
{
|
|
||||||
result = new AssetBundleRequestAllAssetsWithCancellationSource();
|
|
||||||
}
|
|
||||||
|
|
||||||
result.asyncOperation = asyncOperation;
|
|
||||||
result.cancellationToken = cancellationToken;
|
|
||||||
result.completed = false;
|
|
||||||
|
|
||||||
TaskTracker.TrackActiveTask(result, 3);
|
|
||||||
|
|
||||||
PlayerLoopHelper.AddAction(PlayerLoopTiming.Update, result);
|
|
||||||
|
|
||||||
asyncOperation.completed += result.continuationAction;
|
|
||||||
|
|
||||||
token = result.core.Version;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Continuation(AsyncOperation _)
|
|
||||||
{
|
|
||||||
asyncOperation.completed -= continuationAction;
|
|
||||||
|
|
||||||
if (completed)
|
|
||||||
{
|
|
||||||
TryReturn();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
completed = true;
|
|
||||||
if (cancellationToken.IsCancellationRequested)
|
|
||||||
{
|
|
||||||
core.TrySetCanceled(cancellationToken);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
core.TrySetResult(asyncOperation.allAssets);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public UnityEngine.Object[] GetResult(short token)
|
|
||||||
{
|
|
||||||
return core.GetResult(token);
|
|
||||||
}
|
|
||||||
|
|
||||||
void IUniTaskSource.GetResult(short token)
|
|
||||||
{
|
|
||||||
GetResult(token);
|
|
||||||
}
|
|
||||||
|
|
||||||
public UniTaskStatus GetStatus(short token)
|
|
||||||
{
|
|
||||||
return core.GetStatus(token);
|
|
||||||
}
|
|
||||||
|
|
||||||
public UniTaskStatus UnsafeGetStatus()
|
|
||||||
{
|
|
||||||
return core.UnsafeGetStatus();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OnCompleted(Action<object> continuation, object state, short token)
|
|
||||||
{
|
|
||||||
core.OnCompleted(continuation, state, token);
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool MoveNext()
|
|
||||||
{
|
|
||||||
if (completed)
|
|
||||||
{
|
|
||||||
TryReturn();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cancellationToken.IsCancellationRequested)
|
|
||||||
{
|
|
||||||
completed = true;
|
|
||||||
core.TrySetCanceled(cancellationToken);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool TryReturn()
|
|
||||||
{
|
|
||||||
TaskTracker.RemoveTracking(this);
|
|
||||||
core.Reset();
|
|
||||||
asyncOperation = default;
|
|
||||||
cancellationToken = default;
|
|
||||||
return pool.TryPush(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sealed class AssetBundleRequestAllAssetsConfiguredSource : IUniTaskSource<UnityEngine.Object[]>, IPlayerLoopItem, ITaskPoolNode<AssetBundleRequestAllAssetsConfiguredSource>
|
sealed class AssetBundleRequestAllAssetsConfiguredSource : IUniTaskSource<UnityEngine.Object[]>, IPlayerLoopItem, ITaskPoolNode<AssetBundleRequestAllAssetsConfiguredSource>
|
||||||
{
|
{
|
||||||
static TaskPool<AssetBundleRequestAllAssetsConfiguredSource> pool;
|
static TaskPool<AssetBundleRequestAllAssetsConfiguredSource> pool;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
|
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|||||||
@@ -23,10 +23,7 @@ namespace Cysharp.Threading.Tasks
|
|||||||
|
|
||||||
public static UniTask WithCancellation(this AsyncOperation asyncOperation, CancellationToken cancellationToken)
|
public static UniTask WithCancellation(this AsyncOperation asyncOperation, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
Error.ThrowArgumentNullException(asyncOperation, nameof(asyncOperation));
|
return ToUniTask(asyncOperation, cancellationToken: cancellationToken);
|
||||||
if (cancellationToken.IsCancellationRequested) return UniTask.FromCanceled(cancellationToken);
|
|
||||||
if (asyncOperation.isDone) return UniTask.CompletedTask;
|
|
||||||
return new UniTask(AsyncOperationWithCancellationSource.Create(asyncOperation, cancellationToken, out var token), token);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static UniTask ToUniTask(this AsyncOperation asyncOperation, IProgress<float> progress = null, PlayerLoopTiming timing = PlayerLoopTiming.Update, CancellationToken cancellationToken = default(CancellationToken))
|
public static UniTask ToUniTask(this AsyncOperation asyncOperation, IProgress<float> progress = null, PlayerLoopTiming timing = PlayerLoopTiming.Update, CancellationToken cancellationToken = default(CancellationToken))
|
||||||
@@ -77,125 +74,6 @@ namespace Cysharp.Threading.Tasks
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sealed class AsyncOperationWithCancellationSource : IUniTaskSource, IPlayerLoopItem, ITaskPoolNode<AsyncOperationWithCancellationSource>
|
|
||||||
{
|
|
||||||
static TaskPool<AsyncOperationWithCancellationSource> pool;
|
|
||||||
AsyncOperationWithCancellationSource nextNode;
|
|
||||||
public ref AsyncOperationWithCancellationSource NextNode => ref nextNode;
|
|
||||||
|
|
||||||
static AsyncOperationWithCancellationSource()
|
|
||||||
{
|
|
||||||
TaskPool.RegisterSizeGetter(typeof(AsyncOperationWithCancellationSource), () => pool.Size);
|
|
||||||
}
|
|
||||||
|
|
||||||
readonly Action<AsyncOperation> continuationAction;
|
|
||||||
AsyncOperation asyncOperation;
|
|
||||||
CancellationToken cancellationToken;
|
|
||||||
bool completed;
|
|
||||||
|
|
||||||
UniTaskCompletionSourceCore<AsyncUnit> core;
|
|
||||||
|
|
||||||
AsyncOperationWithCancellationSource()
|
|
||||||
{
|
|
||||||
continuationAction = Continuation;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IUniTaskSource Create(AsyncOperation asyncOperation, CancellationToken cancellationToken, out short token)
|
|
||||||
{
|
|
||||||
if (cancellationToken.IsCancellationRequested)
|
|
||||||
{
|
|
||||||
return AutoResetUniTaskCompletionSource.CreateFromCanceled(cancellationToken, out token);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!pool.TryPop(out var result))
|
|
||||||
{
|
|
||||||
result = new AsyncOperationWithCancellationSource();
|
|
||||||
}
|
|
||||||
|
|
||||||
result.asyncOperation = asyncOperation;
|
|
||||||
result.cancellationToken = cancellationToken;
|
|
||||||
result.completed = false;
|
|
||||||
|
|
||||||
TaskTracker.TrackActiveTask(result, 3);
|
|
||||||
|
|
||||||
PlayerLoopHelper.AddAction(PlayerLoopTiming.Update, result);
|
|
||||||
|
|
||||||
asyncOperation.completed += result.continuationAction;
|
|
||||||
|
|
||||||
token = result.core.Version;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Continuation(AsyncOperation _)
|
|
||||||
{
|
|
||||||
asyncOperation.completed -= continuationAction;
|
|
||||||
|
|
||||||
if (completed)
|
|
||||||
{
|
|
||||||
TryReturn();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
completed = true;
|
|
||||||
if (cancellationToken.IsCancellationRequested)
|
|
||||||
{
|
|
||||||
core.TrySetCanceled(cancellationToken);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
core.TrySetResult(AsyncUnit.Default);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void GetResult(short token)
|
|
||||||
{
|
|
||||||
core.GetResult(token);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public UniTaskStatus GetStatus(short token)
|
|
||||||
{
|
|
||||||
return core.GetStatus(token);
|
|
||||||
}
|
|
||||||
|
|
||||||
public UniTaskStatus UnsafeGetStatus()
|
|
||||||
{
|
|
||||||
return core.UnsafeGetStatus();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OnCompleted(Action<object> continuation, object state, short token)
|
|
||||||
{
|
|
||||||
core.OnCompleted(continuation, state, token);
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool MoveNext()
|
|
||||||
{
|
|
||||||
if (completed)
|
|
||||||
{
|
|
||||||
TryReturn();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cancellationToken.IsCancellationRequested)
|
|
||||||
{
|
|
||||||
completed = true;
|
|
||||||
core.TrySetCanceled(cancellationToken);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool TryReturn()
|
|
||||||
{
|
|
||||||
TaskTracker.RemoveTracking(this);
|
|
||||||
core.Reset();
|
|
||||||
asyncOperation = default;
|
|
||||||
cancellationToken = default;
|
|
||||||
return pool.TryPush(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sealed class AsyncOperationConfiguredSource : IUniTaskSource, IPlayerLoopItem, ITaskPoolNode<AsyncOperationConfiguredSource>
|
sealed class AsyncOperationConfiguredSource : IUniTaskSource, IPlayerLoopItem, ITaskPoolNode<AsyncOperationConfiguredSource>
|
||||||
{
|
{
|
||||||
static TaskPool<AsyncOperationConfiguredSource> pool;
|
static TaskPool<AsyncOperationConfiguredSource> pool;
|
||||||
@@ -315,10 +193,7 @@ namespace Cysharp.Threading.Tasks
|
|||||||
|
|
||||||
public static UniTask<UnityEngine.Object> WithCancellation(this ResourceRequest asyncOperation, CancellationToken cancellationToken)
|
public static UniTask<UnityEngine.Object> WithCancellation(this ResourceRequest asyncOperation, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
Error.ThrowArgumentNullException(asyncOperation, nameof(asyncOperation));
|
return ToUniTask(asyncOperation, cancellationToken: cancellationToken);
|
||||||
if (cancellationToken.IsCancellationRequested) return UniTask.FromCanceled<UnityEngine.Object>(cancellationToken);
|
|
||||||
if (asyncOperation.isDone) return UniTask.FromResult(asyncOperation.asset);
|
|
||||||
return new UniTask<UnityEngine.Object>(ResourceRequestWithCancellationSource.Create(asyncOperation, cancellationToken, out var token), token);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static UniTask<UnityEngine.Object> ToUniTask(this ResourceRequest asyncOperation, IProgress<float> progress = null, PlayerLoopTiming timing = PlayerLoopTiming.Update, CancellationToken cancellationToken = default(CancellationToken))
|
public static UniTask<UnityEngine.Object> ToUniTask(this ResourceRequest asyncOperation, IProgress<float> progress = null, PlayerLoopTiming timing = PlayerLoopTiming.Update, CancellationToken cancellationToken = default(CancellationToken))
|
||||||
@@ -373,129 +248,6 @@ namespace Cysharp.Threading.Tasks
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sealed class ResourceRequestWithCancellationSource : IUniTaskSource<UnityEngine.Object>, IPlayerLoopItem, ITaskPoolNode<ResourceRequestWithCancellationSource>
|
|
||||||
{
|
|
||||||
static TaskPool<ResourceRequestWithCancellationSource> pool;
|
|
||||||
ResourceRequestWithCancellationSource nextNode;
|
|
||||||
public ref ResourceRequestWithCancellationSource NextNode => ref nextNode;
|
|
||||||
|
|
||||||
static ResourceRequestWithCancellationSource()
|
|
||||||
{
|
|
||||||
TaskPool.RegisterSizeGetter(typeof(ResourceRequestWithCancellationSource), () => pool.Size);
|
|
||||||
}
|
|
||||||
|
|
||||||
readonly Action<AsyncOperation> continuationAction;
|
|
||||||
ResourceRequest asyncOperation;
|
|
||||||
CancellationToken cancellationToken;
|
|
||||||
bool completed;
|
|
||||||
|
|
||||||
UniTaskCompletionSourceCore<UnityEngine.Object> core;
|
|
||||||
|
|
||||||
ResourceRequestWithCancellationSource()
|
|
||||||
{
|
|
||||||
continuationAction = Continuation;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IUniTaskSource<UnityEngine.Object> Create(ResourceRequest asyncOperation, CancellationToken cancellationToken, out short token)
|
|
||||||
{
|
|
||||||
if (cancellationToken.IsCancellationRequested)
|
|
||||||
{
|
|
||||||
return AutoResetUniTaskCompletionSource<UnityEngine.Object>.CreateFromCanceled(cancellationToken, out token);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!pool.TryPop(out var result))
|
|
||||||
{
|
|
||||||
result = new ResourceRequestWithCancellationSource();
|
|
||||||
}
|
|
||||||
|
|
||||||
result.asyncOperation = asyncOperation;
|
|
||||||
result.cancellationToken = cancellationToken;
|
|
||||||
result.completed = false;
|
|
||||||
|
|
||||||
TaskTracker.TrackActiveTask(result, 3);
|
|
||||||
|
|
||||||
PlayerLoopHelper.AddAction(PlayerLoopTiming.Update, result);
|
|
||||||
|
|
||||||
asyncOperation.completed += result.continuationAction;
|
|
||||||
|
|
||||||
token = result.core.Version;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Continuation(AsyncOperation _)
|
|
||||||
{
|
|
||||||
asyncOperation.completed -= continuationAction;
|
|
||||||
|
|
||||||
if (completed)
|
|
||||||
{
|
|
||||||
TryReturn();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
completed = true;
|
|
||||||
if (cancellationToken.IsCancellationRequested)
|
|
||||||
{
|
|
||||||
core.TrySetCanceled(cancellationToken);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
core.TrySetResult(asyncOperation.asset);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public UnityEngine.Object GetResult(short token)
|
|
||||||
{
|
|
||||||
return core.GetResult(token);
|
|
||||||
}
|
|
||||||
|
|
||||||
void IUniTaskSource.GetResult(short token)
|
|
||||||
{
|
|
||||||
GetResult(token);
|
|
||||||
}
|
|
||||||
|
|
||||||
public UniTaskStatus GetStatus(short token)
|
|
||||||
{
|
|
||||||
return core.GetStatus(token);
|
|
||||||
}
|
|
||||||
|
|
||||||
public UniTaskStatus UnsafeGetStatus()
|
|
||||||
{
|
|
||||||
return core.UnsafeGetStatus();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OnCompleted(Action<object> continuation, object state, short token)
|
|
||||||
{
|
|
||||||
core.OnCompleted(continuation, state, token);
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool MoveNext()
|
|
||||||
{
|
|
||||||
if (completed)
|
|
||||||
{
|
|
||||||
TryReturn();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cancellationToken.IsCancellationRequested)
|
|
||||||
{
|
|
||||||
completed = true;
|
|
||||||
core.TrySetCanceled(cancellationToken);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool TryReturn()
|
|
||||||
{
|
|
||||||
TaskTracker.RemoveTracking(this);
|
|
||||||
core.Reset();
|
|
||||||
asyncOperation = default;
|
|
||||||
cancellationToken = default;
|
|
||||||
return pool.TryPush(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sealed class ResourceRequestConfiguredSource : IUniTaskSource<UnityEngine.Object>, IPlayerLoopItem, ITaskPoolNode<ResourceRequestConfiguredSource>
|
sealed class ResourceRequestConfiguredSource : IUniTaskSource<UnityEngine.Object>, IPlayerLoopItem, ITaskPoolNode<ResourceRequestConfiguredSource>
|
||||||
{
|
{
|
||||||
static TaskPool<ResourceRequestConfiguredSource> pool;
|
static TaskPool<ResourceRequestConfiguredSource> pool;
|
||||||
@@ -620,10 +372,7 @@ namespace Cysharp.Threading.Tasks
|
|||||||
|
|
||||||
public static UniTask<UnityEngine.Object> WithCancellation(this AssetBundleRequest asyncOperation, CancellationToken cancellationToken)
|
public static UniTask<UnityEngine.Object> WithCancellation(this AssetBundleRequest asyncOperation, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
Error.ThrowArgumentNullException(asyncOperation, nameof(asyncOperation));
|
return ToUniTask(asyncOperation, cancellationToken: cancellationToken);
|
||||||
if (cancellationToken.IsCancellationRequested) return UniTask.FromCanceled<UnityEngine.Object>(cancellationToken);
|
|
||||||
if (asyncOperation.isDone) return UniTask.FromResult(asyncOperation.asset);
|
|
||||||
return new UniTask<UnityEngine.Object>(AssetBundleRequestWithCancellationSource.Create(asyncOperation, cancellationToken, out var token), token);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static UniTask<UnityEngine.Object> ToUniTask(this AssetBundleRequest asyncOperation, IProgress<float> progress = null, PlayerLoopTiming timing = PlayerLoopTiming.Update, CancellationToken cancellationToken = default(CancellationToken))
|
public static UniTask<UnityEngine.Object> ToUniTask(this AssetBundleRequest asyncOperation, IProgress<float> progress = null, PlayerLoopTiming timing = PlayerLoopTiming.Update, CancellationToken cancellationToken = default(CancellationToken))
|
||||||
@@ -678,129 +427,6 @@ namespace Cysharp.Threading.Tasks
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sealed class AssetBundleRequestWithCancellationSource : IUniTaskSource<UnityEngine.Object>, IPlayerLoopItem, ITaskPoolNode<AssetBundleRequestWithCancellationSource>
|
|
||||||
{
|
|
||||||
static TaskPool<AssetBundleRequestWithCancellationSource> pool;
|
|
||||||
AssetBundleRequestWithCancellationSource nextNode;
|
|
||||||
public ref AssetBundleRequestWithCancellationSource NextNode => ref nextNode;
|
|
||||||
|
|
||||||
static AssetBundleRequestWithCancellationSource()
|
|
||||||
{
|
|
||||||
TaskPool.RegisterSizeGetter(typeof(AssetBundleRequestWithCancellationSource), () => pool.Size);
|
|
||||||
}
|
|
||||||
|
|
||||||
readonly Action<AsyncOperation> continuationAction;
|
|
||||||
AssetBundleRequest asyncOperation;
|
|
||||||
CancellationToken cancellationToken;
|
|
||||||
bool completed;
|
|
||||||
|
|
||||||
UniTaskCompletionSourceCore<UnityEngine.Object> core;
|
|
||||||
|
|
||||||
AssetBundleRequestWithCancellationSource()
|
|
||||||
{
|
|
||||||
continuationAction = Continuation;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IUniTaskSource<UnityEngine.Object> Create(AssetBundleRequest asyncOperation, CancellationToken cancellationToken, out short token)
|
|
||||||
{
|
|
||||||
if (cancellationToken.IsCancellationRequested)
|
|
||||||
{
|
|
||||||
return AutoResetUniTaskCompletionSource<UnityEngine.Object>.CreateFromCanceled(cancellationToken, out token);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!pool.TryPop(out var result))
|
|
||||||
{
|
|
||||||
result = new AssetBundleRequestWithCancellationSource();
|
|
||||||
}
|
|
||||||
|
|
||||||
result.asyncOperation = asyncOperation;
|
|
||||||
result.cancellationToken = cancellationToken;
|
|
||||||
result.completed = false;
|
|
||||||
|
|
||||||
TaskTracker.TrackActiveTask(result, 3);
|
|
||||||
|
|
||||||
PlayerLoopHelper.AddAction(PlayerLoopTiming.Update, result);
|
|
||||||
|
|
||||||
asyncOperation.completed += result.continuationAction;
|
|
||||||
|
|
||||||
token = result.core.Version;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Continuation(AsyncOperation _)
|
|
||||||
{
|
|
||||||
asyncOperation.completed -= continuationAction;
|
|
||||||
|
|
||||||
if (completed)
|
|
||||||
{
|
|
||||||
TryReturn();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
completed = true;
|
|
||||||
if (cancellationToken.IsCancellationRequested)
|
|
||||||
{
|
|
||||||
core.TrySetCanceled(cancellationToken);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
core.TrySetResult(asyncOperation.asset);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public UnityEngine.Object GetResult(short token)
|
|
||||||
{
|
|
||||||
return core.GetResult(token);
|
|
||||||
}
|
|
||||||
|
|
||||||
void IUniTaskSource.GetResult(short token)
|
|
||||||
{
|
|
||||||
GetResult(token);
|
|
||||||
}
|
|
||||||
|
|
||||||
public UniTaskStatus GetStatus(short token)
|
|
||||||
{
|
|
||||||
return core.GetStatus(token);
|
|
||||||
}
|
|
||||||
|
|
||||||
public UniTaskStatus UnsafeGetStatus()
|
|
||||||
{
|
|
||||||
return core.UnsafeGetStatus();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OnCompleted(Action<object> continuation, object state, short token)
|
|
||||||
{
|
|
||||||
core.OnCompleted(continuation, state, token);
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool MoveNext()
|
|
||||||
{
|
|
||||||
if (completed)
|
|
||||||
{
|
|
||||||
TryReturn();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cancellationToken.IsCancellationRequested)
|
|
||||||
{
|
|
||||||
completed = true;
|
|
||||||
core.TrySetCanceled(cancellationToken);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool TryReturn()
|
|
||||||
{
|
|
||||||
TaskTracker.RemoveTracking(this);
|
|
||||||
core.Reset();
|
|
||||||
asyncOperation = default;
|
|
||||||
cancellationToken = default;
|
|
||||||
return pool.TryPush(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sealed class AssetBundleRequestConfiguredSource : IUniTaskSource<UnityEngine.Object>, IPlayerLoopItem, ITaskPoolNode<AssetBundleRequestConfiguredSource>
|
sealed class AssetBundleRequestConfiguredSource : IUniTaskSource<UnityEngine.Object>, IPlayerLoopItem, ITaskPoolNode<AssetBundleRequestConfiguredSource>
|
||||||
{
|
{
|
||||||
static TaskPool<AssetBundleRequestConfiguredSource> pool;
|
static TaskPool<AssetBundleRequestConfiguredSource> pool;
|
||||||
@@ -926,10 +552,7 @@ namespace Cysharp.Threading.Tasks
|
|||||||
|
|
||||||
public static UniTask<AssetBundle> WithCancellation(this AssetBundleCreateRequest asyncOperation, CancellationToken cancellationToken)
|
public static UniTask<AssetBundle> WithCancellation(this AssetBundleCreateRequest asyncOperation, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
Error.ThrowArgumentNullException(asyncOperation, nameof(asyncOperation));
|
return ToUniTask(asyncOperation, cancellationToken: cancellationToken);
|
||||||
if (cancellationToken.IsCancellationRequested) return UniTask.FromCanceled<AssetBundle>(cancellationToken);
|
|
||||||
if (asyncOperation.isDone) return UniTask.FromResult(asyncOperation.assetBundle);
|
|
||||||
return new UniTask<AssetBundle>(AssetBundleCreateRequestWithCancellationSource.Create(asyncOperation, cancellationToken, out var token), token);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static UniTask<AssetBundle> ToUniTask(this AssetBundleCreateRequest asyncOperation, IProgress<float> progress = null, PlayerLoopTiming timing = PlayerLoopTiming.Update, CancellationToken cancellationToken = default(CancellationToken))
|
public static UniTask<AssetBundle> ToUniTask(this AssetBundleCreateRequest asyncOperation, IProgress<float> progress = null, PlayerLoopTiming timing = PlayerLoopTiming.Update, CancellationToken cancellationToken = default(CancellationToken))
|
||||||
@@ -984,129 +607,6 @@ namespace Cysharp.Threading.Tasks
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sealed class AssetBundleCreateRequestWithCancellationSource : IUniTaskSource<AssetBundle>, IPlayerLoopItem, ITaskPoolNode<AssetBundleCreateRequestWithCancellationSource>
|
|
||||||
{
|
|
||||||
static TaskPool<AssetBundleCreateRequestWithCancellationSource> pool;
|
|
||||||
AssetBundleCreateRequestWithCancellationSource nextNode;
|
|
||||||
public ref AssetBundleCreateRequestWithCancellationSource NextNode => ref nextNode;
|
|
||||||
|
|
||||||
static AssetBundleCreateRequestWithCancellationSource()
|
|
||||||
{
|
|
||||||
TaskPool.RegisterSizeGetter(typeof(AssetBundleCreateRequestWithCancellationSource), () => pool.Size);
|
|
||||||
}
|
|
||||||
|
|
||||||
readonly Action<AsyncOperation> continuationAction;
|
|
||||||
AssetBundleCreateRequest asyncOperation;
|
|
||||||
CancellationToken cancellationToken;
|
|
||||||
bool completed;
|
|
||||||
|
|
||||||
UniTaskCompletionSourceCore<AssetBundle> core;
|
|
||||||
|
|
||||||
AssetBundleCreateRequestWithCancellationSource()
|
|
||||||
{
|
|
||||||
continuationAction = Continuation;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IUniTaskSource<AssetBundle> Create(AssetBundleCreateRequest asyncOperation, CancellationToken cancellationToken, out short token)
|
|
||||||
{
|
|
||||||
if (cancellationToken.IsCancellationRequested)
|
|
||||||
{
|
|
||||||
return AutoResetUniTaskCompletionSource<AssetBundle>.CreateFromCanceled(cancellationToken, out token);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!pool.TryPop(out var result))
|
|
||||||
{
|
|
||||||
result = new AssetBundleCreateRequestWithCancellationSource();
|
|
||||||
}
|
|
||||||
|
|
||||||
result.asyncOperation = asyncOperation;
|
|
||||||
result.cancellationToken = cancellationToken;
|
|
||||||
result.completed = false;
|
|
||||||
|
|
||||||
TaskTracker.TrackActiveTask(result, 3);
|
|
||||||
|
|
||||||
PlayerLoopHelper.AddAction(PlayerLoopTiming.Update, result);
|
|
||||||
|
|
||||||
asyncOperation.completed += result.continuationAction;
|
|
||||||
|
|
||||||
token = result.core.Version;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Continuation(AsyncOperation _)
|
|
||||||
{
|
|
||||||
asyncOperation.completed -= continuationAction;
|
|
||||||
|
|
||||||
if (completed)
|
|
||||||
{
|
|
||||||
TryReturn();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
completed = true;
|
|
||||||
if (cancellationToken.IsCancellationRequested)
|
|
||||||
{
|
|
||||||
core.TrySetCanceled(cancellationToken);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
core.TrySetResult(asyncOperation.assetBundle);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public AssetBundle GetResult(short token)
|
|
||||||
{
|
|
||||||
return core.GetResult(token);
|
|
||||||
}
|
|
||||||
|
|
||||||
void IUniTaskSource.GetResult(short token)
|
|
||||||
{
|
|
||||||
GetResult(token);
|
|
||||||
}
|
|
||||||
|
|
||||||
public UniTaskStatus GetStatus(short token)
|
|
||||||
{
|
|
||||||
return core.GetStatus(token);
|
|
||||||
}
|
|
||||||
|
|
||||||
public UniTaskStatus UnsafeGetStatus()
|
|
||||||
{
|
|
||||||
return core.UnsafeGetStatus();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OnCompleted(Action<object> continuation, object state, short token)
|
|
||||||
{
|
|
||||||
core.OnCompleted(continuation, state, token);
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool MoveNext()
|
|
||||||
{
|
|
||||||
if (completed)
|
|
||||||
{
|
|
||||||
TryReturn();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cancellationToken.IsCancellationRequested)
|
|
||||||
{
|
|
||||||
completed = true;
|
|
||||||
core.TrySetCanceled(cancellationToken);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool TryReturn()
|
|
||||||
{
|
|
||||||
TaskTracker.RemoveTracking(this);
|
|
||||||
core.Reset();
|
|
||||||
asyncOperation = default;
|
|
||||||
cancellationToken = default;
|
|
||||||
return pool.TryPush(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sealed class AssetBundleCreateRequestConfiguredSource : IUniTaskSource<AssetBundle>, IPlayerLoopItem, ITaskPoolNode<AssetBundleCreateRequestConfiguredSource>
|
sealed class AssetBundleCreateRequestConfiguredSource : IUniTaskSource<AssetBundle>, IPlayerLoopItem, ITaskPoolNode<AssetBundleCreateRequestConfiguredSource>
|
||||||
{
|
{
|
||||||
static TaskPool<AssetBundleCreateRequestConfiguredSource> pool;
|
static TaskPool<AssetBundleCreateRequestConfiguredSource> pool;
|
||||||
@@ -1232,17 +732,7 @@ namespace Cysharp.Threading.Tasks
|
|||||||
|
|
||||||
public static UniTask<UnityWebRequest> WithCancellation(this UnityWebRequestAsyncOperation asyncOperation, CancellationToken cancellationToken)
|
public static UniTask<UnityWebRequest> WithCancellation(this UnityWebRequestAsyncOperation asyncOperation, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
Error.ThrowArgumentNullException(asyncOperation, nameof(asyncOperation));
|
return ToUniTask(asyncOperation, cancellationToken: cancellationToken);
|
||||||
if (cancellationToken.IsCancellationRequested) return UniTask.FromCanceled<UnityWebRequest>(cancellationToken);
|
|
||||||
if (asyncOperation.isDone)
|
|
||||||
{
|
|
||||||
if (asyncOperation.webRequest.IsError())
|
|
||||||
{
|
|
||||||
return UniTask.FromException<UnityWebRequest>(new UnityWebRequestException(asyncOperation.webRequest));
|
|
||||||
}
|
|
||||||
return UniTask.FromResult(asyncOperation.webRequest);
|
|
||||||
}
|
|
||||||
return new UniTask<UnityWebRequest>(UnityWebRequestAsyncOperationWithCancellationSource.Create(asyncOperation, cancellationToken, out var token), token);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static UniTask<UnityWebRequest> ToUniTask(this UnityWebRequestAsyncOperation asyncOperation, IProgress<float> progress = null, PlayerLoopTiming timing = PlayerLoopTiming.Update, CancellationToken cancellationToken = default(CancellationToken))
|
public static UniTask<UnityWebRequest> ToUniTask(this UnityWebRequestAsyncOperation asyncOperation, IProgress<float> progress = null, PlayerLoopTiming timing = PlayerLoopTiming.Update, CancellationToken cancellationToken = default(CancellationToken))
|
||||||
@@ -1312,138 +802,6 @@ namespace Cysharp.Threading.Tasks
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sealed class UnityWebRequestAsyncOperationWithCancellationSource : IUniTaskSource<UnityWebRequest>, IPlayerLoopItem, ITaskPoolNode<UnityWebRequestAsyncOperationWithCancellationSource>
|
|
||||||
{
|
|
||||||
static TaskPool<UnityWebRequestAsyncOperationWithCancellationSource> pool;
|
|
||||||
UnityWebRequestAsyncOperationWithCancellationSource nextNode;
|
|
||||||
public ref UnityWebRequestAsyncOperationWithCancellationSource NextNode => ref nextNode;
|
|
||||||
|
|
||||||
static UnityWebRequestAsyncOperationWithCancellationSource()
|
|
||||||
{
|
|
||||||
TaskPool.RegisterSizeGetter(typeof(UnityWebRequestAsyncOperationWithCancellationSource), () => pool.Size);
|
|
||||||
}
|
|
||||||
|
|
||||||
readonly Action<AsyncOperation> continuationAction;
|
|
||||||
UnityWebRequestAsyncOperation asyncOperation;
|
|
||||||
CancellationToken cancellationToken;
|
|
||||||
bool completed;
|
|
||||||
|
|
||||||
UniTaskCompletionSourceCore<UnityWebRequest> core;
|
|
||||||
|
|
||||||
UnityWebRequestAsyncOperationWithCancellationSource()
|
|
||||||
{
|
|
||||||
continuationAction = Continuation;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IUniTaskSource<UnityWebRequest> Create(UnityWebRequestAsyncOperation asyncOperation, CancellationToken cancellationToken, out short token)
|
|
||||||
{
|
|
||||||
if (cancellationToken.IsCancellationRequested)
|
|
||||||
{
|
|
||||||
return AutoResetUniTaskCompletionSource<UnityWebRequest>.CreateFromCanceled(cancellationToken, out token);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!pool.TryPop(out var result))
|
|
||||||
{
|
|
||||||
result = new UnityWebRequestAsyncOperationWithCancellationSource();
|
|
||||||
}
|
|
||||||
|
|
||||||
result.asyncOperation = asyncOperation;
|
|
||||||
result.cancellationToken = cancellationToken;
|
|
||||||
result.completed = false;
|
|
||||||
|
|
||||||
TaskTracker.TrackActiveTask(result, 3);
|
|
||||||
|
|
||||||
PlayerLoopHelper.AddAction(PlayerLoopTiming.Update, result);
|
|
||||||
|
|
||||||
asyncOperation.completed += result.continuationAction;
|
|
||||||
|
|
||||||
token = result.core.Version;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Continuation(AsyncOperation _)
|
|
||||||
{
|
|
||||||
asyncOperation.completed -= continuationAction;
|
|
||||||
|
|
||||||
if (completed)
|
|
||||||
{
|
|
||||||
TryReturn();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
completed = true;
|
|
||||||
if (cancellationToken.IsCancellationRequested)
|
|
||||||
{
|
|
||||||
core.TrySetCanceled(cancellationToken);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var result = asyncOperation.webRequest;
|
|
||||||
if (result.IsError())
|
|
||||||
{
|
|
||||||
core.TrySetException(new UnityWebRequestException(result));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
core.TrySetResult(result);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public UnityWebRequest GetResult(short token)
|
|
||||||
{
|
|
||||||
return core.GetResult(token);
|
|
||||||
}
|
|
||||||
|
|
||||||
void IUniTaskSource.GetResult(short token)
|
|
||||||
{
|
|
||||||
GetResult(token);
|
|
||||||
}
|
|
||||||
|
|
||||||
public UniTaskStatus GetStatus(short token)
|
|
||||||
{
|
|
||||||
return core.GetStatus(token);
|
|
||||||
}
|
|
||||||
|
|
||||||
public UniTaskStatus UnsafeGetStatus()
|
|
||||||
{
|
|
||||||
return core.UnsafeGetStatus();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OnCompleted(Action<object> continuation, object state, short token)
|
|
||||||
{
|
|
||||||
core.OnCompleted(continuation, state, token);
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool MoveNext()
|
|
||||||
{
|
|
||||||
if (completed)
|
|
||||||
{
|
|
||||||
TryReturn();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cancellationToken.IsCancellationRequested)
|
|
||||||
{
|
|
||||||
completed = true;
|
|
||||||
asyncOperation.webRequest.Abort();
|
|
||||||
core.TrySetCanceled(cancellationToken);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool TryReturn()
|
|
||||||
{
|
|
||||||
TaskTracker.RemoveTracking(this);
|
|
||||||
core.Reset();
|
|
||||||
asyncOperation = default;
|
|
||||||
cancellationToken = default;
|
|
||||||
return pool.TryPush(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sealed class UnityWebRequestAsyncOperationConfiguredSource : IUniTaskSource<UnityWebRequest>, IPlayerLoopItem, ITaskPoolNode<UnityWebRequestAsyncOperationConfiguredSource>
|
sealed class UnityWebRequestAsyncOperationConfiguredSource : IUniTaskSource<UnityWebRequest>, IPlayerLoopItem, ITaskPoolNode<UnityWebRequestAsyncOperationConfiguredSource>
|
||||||
{
|
{
|
||||||
static TaskPool<UnityWebRequestAsyncOperationConfiguredSource> pool;
|
static TaskPool<UnityWebRequestAsyncOperationConfiguredSource> pool;
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
("ResourceRequest", "UnityEngine.Object", "asset"),
|
("ResourceRequest", "UnityEngine.Object", "asset"),
|
||||||
("AssetBundleRequest", "UnityEngine.Object", "asset"), // allAssets?
|
("AssetBundleRequest", "UnityEngine.Object", "asset"), // allAssets?
|
||||||
("AssetBundleCreateRequest", "AssetBundle", "assetBundle"),
|
("AssetBundleCreateRequest", "AssetBundle", "assetBundle"),
|
||||||
("UnityWebRequestAsyncOperation", "UnityWebRequest", "webRequest") // -> #if ENABLE_UNITYWEBREQUEST
|
("UnityWebRequestAsyncOperation", "UnityWebRequest", "webRequest") // -> #if ENABLE_UNITYWEBREQUEST && (!UNITY_2019_1_OR_NEWER || UNITASK_WEBREQUEST_SUPPORT)
|
||||||
};
|
};
|
||||||
|
|
||||||
Func<string, string> ToUniTaskReturnType = x => (x == "void") ? "UniTask" : $"UniTask<{x}>";
|
Func<string, string> ToUniTaskReturnType = x => (x == "void") ? "UniTask" : $"UniTask<{x}>";
|
||||||
@@ -27,7 +27,7 @@ using System.Runtime.CompilerServices;
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Cysharp.Threading.Tasks.Internal;
|
using Cysharp.Threading.Tasks.Internal;
|
||||||
#if ENABLE_UNITYWEBREQUEST
|
#if ENABLE_UNITYWEBREQUEST && (!UNITY_2019_1_OR_NEWER || UNITASK_WEBREQUEST_SUPPORT)
|
||||||
using UnityEngine.Networking;
|
using UnityEngine.Networking;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -37,7 +37,7 @@ namespace Cysharp.Threading.Tasks
|
|||||||
{
|
{
|
||||||
<# foreach(var t in types) { #>
|
<# foreach(var t in types) { #>
|
||||||
<# if(IsUnityWebRequest(t)) { #>
|
<# if(IsUnityWebRequest(t)) { #>
|
||||||
#if ENABLE_UNITYWEBREQUEST
|
#if ENABLE_UNITYWEBREQUEST && (!UNITY_2019_1_OR_NEWER || UNITASK_WEBREQUEST_SUPPORT)
|
||||||
<# } else if(IsAssetBundleModule(t)) { #>
|
<# } else if(IsAssetBundleModule(t)) { #>
|
||||||
#if UNITASK_ASSETBUNDLE_SUPPORT
|
#if UNITASK_ASSETBUNDLE_SUPPORT
|
||||||
<# } #>
|
<# } #>
|
||||||
@@ -51,21 +51,7 @@ namespace Cysharp.Threading.Tasks
|
|||||||
|
|
||||||
public static <#= ToUniTaskReturnType(t.returnType) #> WithCancellation(this <#= t.typeName #> asyncOperation, CancellationToken cancellationToken)
|
public static <#= ToUniTaskReturnType(t.returnType) #> WithCancellation(this <#= t.typeName #> asyncOperation, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
Error.ThrowArgumentNullException(asyncOperation, nameof(asyncOperation));
|
return ToUniTask(asyncOperation, cancellationToken: cancellationToken);
|
||||||
if (cancellationToken.IsCancellationRequested) return UniTask.FromCanceled<#= IsVoid(t) ? "" : "<" + t.returnType + ">" #>(cancellationToken);
|
|
||||||
<# if(IsUnityWebRequest(t)) { #>
|
|
||||||
if (asyncOperation.isDone)
|
|
||||||
{
|
|
||||||
if (asyncOperation.webRequest.IsError())
|
|
||||||
{
|
|
||||||
return UniTask.FromException<UnityWebRequest>(new UnityWebRequestException(asyncOperation.webRequest));
|
|
||||||
}
|
|
||||||
return UniTask.FromResult(asyncOperation.webRequest);
|
|
||||||
}
|
|
||||||
<# } else { #>
|
|
||||||
if (asyncOperation.isDone) return <#= IsVoid(t) ? "UniTask.CompletedTask" : $"UniTask.FromResult(asyncOperation.{t.returnField})" #>;
|
|
||||||
<# } #>
|
|
||||||
return new <#= ToUniTaskReturnType(t.returnType) #>(<#= t.typeName #>WithCancellationSource.Create(asyncOperation, cancellationToken, out var token), token);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <#= ToUniTaskReturnType(t.returnType) #> ToUniTask(this <#= t.typeName #> asyncOperation, IProgress<float> progress = null, PlayerLoopTiming timing = PlayerLoopTiming.Update, CancellationToken cancellationToken = default(CancellationToken))
|
public static <#= ToUniTaskReturnType(t.returnType) #> ToUniTask(this <#= t.typeName #> asyncOperation, IProgress<float> progress = null, PlayerLoopTiming timing = PlayerLoopTiming.Update, CancellationToken cancellationToken = default(CancellationToken))
|
||||||
@@ -151,150 +137,6 @@ namespace Cysharp.Threading.Tasks
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sealed class <#= t.typeName #>WithCancellationSource : <#= ToIUniTaskSourceReturnType(t.returnType) #>, IPlayerLoopItem, ITaskPoolNode<<#= t.typeName #>WithCancellationSource>
|
|
||||||
{
|
|
||||||
static TaskPool<<#= t.typeName #>WithCancellationSource> pool;
|
|
||||||
<#= t.typeName #>WithCancellationSource nextNode;
|
|
||||||
public ref <#= t.typeName #>WithCancellationSource NextNode => ref nextNode;
|
|
||||||
|
|
||||||
static <#= t.typeName #>WithCancellationSource()
|
|
||||||
{
|
|
||||||
TaskPool.RegisterSizeGetter(typeof(<#= t.typeName #>WithCancellationSource), () => pool.Size);
|
|
||||||
}
|
|
||||||
|
|
||||||
readonly Action<AsyncOperation> continuationAction;
|
|
||||||
<#= t.typeName #> asyncOperation;
|
|
||||||
CancellationToken cancellationToken;
|
|
||||||
bool completed;
|
|
||||||
|
|
||||||
UniTaskCompletionSourceCore<<#= IsVoid(t) ? "AsyncUnit" : t.returnType #>> core;
|
|
||||||
|
|
||||||
<#= t.typeName #>WithCancellationSource()
|
|
||||||
{
|
|
||||||
continuationAction = Continuation;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static <#= ToIUniTaskSourceReturnType(t.returnType) #> Create(<#= t.typeName #> asyncOperation, CancellationToken cancellationToken, out short token)
|
|
||||||
{
|
|
||||||
if (cancellationToken.IsCancellationRequested)
|
|
||||||
{
|
|
||||||
return AutoResetUniTaskCompletionSource<#= IsVoid(t) ? "" : $"<{t.returnType}>" #>.CreateFromCanceled(cancellationToken, out token);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!pool.TryPop(out var result))
|
|
||||||
{
|
|
||||||
result = new <#= t.typeName #>WithCancellationSource();
|
|
||||||
}
|
|
||||||
|
|
||||||
result.asyncOperation = asyncOperation;
|
|
||||||
result.cancellationToken = cancellationToken;
|
|
||||||
result.completed = false;
|
|
||||||
|
|
||||||
TaskTracker.TrackActiveTask(result, 3);
|
|
||||||
|
|
||||||
PlayerLoopHelper.AddAction(PlayerLoopTiming.Update, result);
|
|
||||||
|
|
||||||
asyncOperation.completed += result.continuationAction;
|
|
||||||
|
|
||||||
token = result.core.Version;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Continuation(AsyncOperation _)
|
|
||||||
{
|
|
||||||
asyncOperation.completed -= continuationAction;
|
|
||||||
|
|
||||||
if (completed)
|
|
||||||
{
|
|
||||||
TryReturn();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
completed = true;
|
|
||||||
if (cancellationToken.IsCancellationRequested)
|
|
||||||
{
|
|
||||||
core.TrySetCanceled(cancellationToken);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
<# if(IsUnityWebRequest(t)) { #>
|
|
||||||
var result = asyncOperation.webRequest;
|
|
||||||
if (result.IsError())
|
|
||||||
{
|
|
||||||
core.TrySetException(new UnityWebRequestException(result));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
core.TrySetResult(result);
|
|
||||||
}
|
|
||||||
<# } else { #>
|
|
||||||
core.TrySetResult(<#= IsVoid(t) ? "AsyncUnit.Default" : $"asyncOperation.{t.returnField}" #>);
|
|
||||||
<# } #>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public <#= t.returnType #> GetResult(short token)
|
|
||||||
{
|
|
||||||
<# if (!IsVoid(t)) { #>
|
|
||||||
return core.GetResult(token);
|
|
||||||
<# } else { #>
|
|
||||||
core.GetResult(token);
|
|
||||||
<# } #>
|
|
||||||
}
|
|
||||||
|
|
||||||
<# if (!IsVoid(t)) { #>
|
|
||||||
void IUniTaskSource.GetResult(short token)
|
|
||||||
{
|
|
||||||
GetResult(token);
|
|
||||||
}
|
|
||||||
<# } #>
|
|
||||||
|
|
||||||
public UniTaskStatus GetStatus(short token)
|
|
||||||
{
|
|
||||||
return core.GetStatus(token);
|
|
||||||
}
|
|
||||||
|
|
||||||
public UniTaskStatus UnsafeGetStatus()
|
|
||||||
{
|
|
||||||
return core.UnsafeGetStatus();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OnCompleted(Action<object> continuation, object state, short token)
|
|
||||||
{
|
|
||||||
core.OnCompleted(continuation, state, token);
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool MoveNext()
|
|
||||||
{
|
|
||||||
if (completed)
|
|
||||||
{
|
|
||||||
TryReturn();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cancellationToken.IsCancellationRequested)
|
|
||||||
{
|
|
||||||
completed = true;
|
|
||||||
<# if(IsUnityWebRequest(t)) { #>
|
|
||||||
asyncOperation.webRequest.Abort();
|
|
||||||
<# } #>
|
|
||||||
core.TrySetCanceled(cancellationToken);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool TryReturn()
|
|
||||||
{
|
|
||||||
TaskTracker.RemoveTracking(this);
|
|
||||||
core.Reset();
|
|
||||||
asyncOperation = default;
|
|
||||||
cancellationToken = default;
|
|
||||||
return pool.TryPush(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sealed class <#= t.typeName #>ConfiguredSource : <#= ToIUniTaskSourceReturnType(t.returnType) #>, IPlayerLoopItem, ITaskPoolNode<<#= t.typeName #>ConfiguredSource>
|
sealed class <#= t.typeName #>ConfiguredSource : <#= ToIUniTaskSourceReturnType(t.returnType) #>, IPlayerLoopItem, ITaskPoolNode<<#= t.typeName #>ConfiguredSource>
|
||||||
{
|
{
|
||||||
static TaskPool<<#= t.typeName #>ConfiguredSource> pool;
|
static TaskPool<<#= t.typeName #>ConfiguredSource> pool;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "com.cysharp.unitask",
|
"name": "com.cysharp.unitask",
|
||||||
"displayName": "UniTask",
|
"displayName": "UniTask",
|
||||||
"version": "2.1.1",
|
"version": "2.2.2",
|
||||||
"unity": "2018.4",
|
"unity": "2018.4",
|
||||||
"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" ],
|
||||||
|
|||||||
@@ -11,30 +11,33 @@ public class Test1
|
|||||||
public static async UniTaskVoid TestFunc()
|
public static async UniTaskVoid TestFunc()
|
||||||
{
|
{
|
||||||
await DoSomeThing();
|
await DoSomeThing();
|
||||||
string[] scenes = new string[]
|
//string[] scenes = new string[]
|
||||||
{
|
//{
|
||||||
"Assets/Scenes/SandboxMain.unity",
|
// "Assets/Scenes/SandboxMain.unity",
|
||||||
};
|
//};
|
||||||
|
|
||||||
try
|
//try
|
||||||
{
|
//{
|
||||||
Debug.Log("Build Begin");
|
// Debug.Log("Build Begin");
|
||||||
BuildPipeline.BuildPlayer(scenes, Application.dataPath + "../target", BuildTarget.StandaloneWindows, BuildOptions.CompressWithLz4);
|
// BuildPipeline.BuildPlayer(scenes, Application.dataPath + "../target", BuildTarget.StandaloneWindows, BuildOptions.CompressWithLz4);
|
||||||
Debug.Log("Build After");
|
// Debug.Log("Build After");
|
||||||
}
|
//}
|
||||||
catch (Exception e)
|
//catch (Exception e)
|
||||||
{
|
//{
|
||||||
Debug.LogError(e.Message);
|
// Debug.LogError(e.Message);
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async UniTask DoSomeThing()
|
public static async UniTask DoSomeThing()
|
||||||
{
|
{
|
||||||
Debug.Log("Dosomething");
|
Debug.Log("Dosomething");
|
||||||
await UniTask.Delay(1500, DelayType.Realtime);
|
await UniTask.Delay(1500, DelayType.DeltaTime);
|
||||||
Debug.Log("Dosomething 2");
|
Debug.Log("Dosomething 2");
|
||||||
await UniTask.Delay(1000, DelayType.Realtime);
|
await UniTask.Delay(1000, DelayType.DeltaTime);
|
||||||
Debug.Log("Dosomething 3");
|
Debug.Log("Dosomething 3");
|
||||||
|
Debug.Log("and Quit.");
|
||||||
|
|
||||||
|
Environment.Exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -542,26 +542,116 @@ public class SandboxMain : MonoBehaviour
|
|||||||
{
|
{
|
||||||
Debug.LogError(e);
|
Debug.LogError(e);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Debug.Log("TestAsync Finished.");
|
Debug.Log("TestAsync Finished.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async UniTaskVoid Start()
|
async UniTaskVoid Start()
|
||||||
{
|
{
|
||||||
var cts = new CancellationTokenSource();
|
|
||||||
|
|
||||||
TestAsync(cts.Token).Forget();
|
// UniTask.Delay(TimeSpan.FromSeconds(1)).TimeoutWithoutException
|
||||||
|
|
||||||
|
|
||||||
|
var currentLoop = PlayerLoop.GetDefaultPlayerLoop();
|
||||||
|
PlayerLoopHelper.Initialize(ref currentLoop, InjectPlayerLoopTimings.Minimum); // minimum is Update | FixedUpdate | LastPostLateUpdate
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var cancelToken = new CancellationTokenSource();
|
||||||
|
cancelButton.onClick.AddListener(()=>
|
||||||
|
{
|
||||||
|
cancelToken.Cancel(); // cancel from button click.
|
||||||
|
});
|
||||||
|
|
||||||
|
var timeoutToken = new CancellationTokenSource();
|
||||||
|
timeoutToken.CancelAfterSlim(TimeSpan.FromSeconds(5)); // 5sec timeout.
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// combine token
|
||||||
|
var linkedTokenSource = CancellationTokenSource.CreateLinkedTokenSource(cancelToken.Token, timeoutToken.Token);
|
||||||
|
|
||||||
|
await UnityWebRequest.Get("http://foo").SendWebRequest().WithCancellation(linkedTokenSource.Token);
|
||||||
|
}
|
||||||
|
catch (OperationCanceledException ex)
|
||||||
|
{
|
||||||
|
if (timeoutToken.IsCancellationRequested)
|
||||||
|
{
|
||||||
|
UnityEngine.Debug.Log("Timeout.");
|
||||||
|
}
|
||||||
|
else if (cancelToken.IsCancellationRequested)
|
||||||
|
{
|
||||||
|
UnityEngine.Debug.Log("Cancel clicked.");
|
||||||
|
}
|
||||||
|
_ = ex;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// TestAsync(cts.Token).Forget();
|
||||||
|
|
||||||
okButton.onClick.AddListener(UniTask.UnityAction(async () =>
|
okButton.onClick.AddListener(UniTask.UnityAction(async () =>
|
||||||
{
|
{
|
||||||
cts.Cancel();
|
// try timeout
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//await UniTask.Delay(TimeSpan.FromSeconds(2), cancellationToken: timeoutController.Timeout(TimeSpan.FromSeconds(3)));
|
||||||
|
UnityEngine.Debug.Log("Delay Complete, Reset(and reuse).");
|
||||||
|
//timeoutController.Reset();
|
||||||
|
}
|
||||||
|
catch (OperationCanceledException ex)
|
||||||
|
{
|
||||||
|
//UnityEngine.Debug.Log("Timeout! FromTimeout?:" + timeoutController.IsTimeout());
|
||||||
|
_ = ex;
|
||||||
|
}
|
||||||
|
|
||||||
|
await UniTask.Yield();
|
||||||
|
}));
|
||||||
|
|
||||||
|
cancelButton.onClick.AddListener(UniTask.UnityAction(async () =>
|
||||||
|
{
|
||||||
|
//clickCancelSource.Cancel();
|
||||||
|
|
||||||
|
//RunCheck(PlayerLoopTiming.Initialization).Forget();
|
||||||
|
//RunCheck(PlayerLoopTiming.LastInitialization).Forget();
|
||||||
|
//RunCheck(PlayerLoopTiming.EarlyUpdate).Forget();
|
||||||
|
//RunCheck(PlayerLoopTiming.LastEarlyUpdate).Forget();
|
||||||
|
//RunCheck(PlayerLoopTiming.FixedUpdate).Forget();
|
||||||
|
//RunCheck(PlayerLoopTiming.LastFixedUpdate).Forget();
|
||||||
|
//RunCheck(PlayerLoopTiming.PreUpdate).Forget();
|
||||||
|
//RunCheck(PlayerLoopTiming.LastPreUpdate).Forget();
|
||||||
|
//RunCheck(PlayerLoopTiming.Update).Forget();
|
||||||
|
//RunCheck(PlayerLoopTiming.LastUpdate).Forget();
|
||||||
|
//RunCheck(PlayerLoopTiming.PreLateUpdate).Forget();
|
||||||
|
//RunCheck(PlayerLoopTiming.LastPreLateUpdate).Forget();
|
||||||
|
//RunCheck(PlayerLoopTiming.PostLateUpdate).Forget();
|
||||||
|
//RunCheck(PlayerLoopTiming.LastPostLateUpdate).Forget();
|
||||||
|
|
||||||
await UniTask.Yield();
|
await UniTask.Yield();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
await UniTask.Yield();
|
await UniTask.Yield();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async UniTaskVoid RunCheck(PlayerLoopTiming timing)
|
||||||
|
{
|
||||||
|
//await UniTask.Yield(timing);
|
||||||
|
//UnityEngine.Debug.Log("Yield:" + timing);
|
||||||
|
await UniTask.DelayFrame(1, timing);
|
||||||
|
UnityEngine.Debug.Log("Delay:" + timing);
|
||||||
|
}
|
||||||
|
|
||||||
private void Application_logMessageReceived2(string condition, string stackTrace, LogType type)
|
private void Application_logMessageReceived2(string condition, string stackTrace, LogType type)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
|
|||||||
@@ -12,16 +12,16 @@ public class FooMonoBehaviour : MonoBehaviour
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async UniTask Download(UnityWebRequest req, string filePath)
|
//private async UniTask Download(UnityWebRequest req, string filePath)
|
||||||
{
|
//{
|
||||||
_ = req.SendWebRequest();
|
// _ = req.SendWebRequest();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// var aaa = await foo;
|
// // var aaa = await foo;
|
||||||
// Debug.Log(aaa);
|
// // Debug.Log(aaa);
|
||||||
await UniTask.Yield();
|
// await UniTask.Yield();
|
||||||
//File.WriteAllText(filePath, req.downloadHandler.text ?? string.Empty);
|
// //File.WriteAllText(filePath, req.downloadHandler.text ?? string.Empty);
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
m_EditorVersion: 2020.2.0f1
|
m_EditorVersion: 2020.2.1f1
|
||||||
m_EditorVersionWithRevision: 2020.2.0f1 (3721df5a8b28)
|
m_EditorVersionWithRevision: 2020.2.1f1 (270dd8c3da1c)
|
||||||
|
|||||||
Reference in New Issue
Block a user