Merge remote-tracking branch 'origin/master'

master
neuecc 2020-08-13 16:33:41 +09:00
commit d5455f3716
2 changed files with 23 additions and 22 deletions

View File

@ -42,13 +42,6 @@ jobs:
steps: steps:
- run: apt update && apt install git -y - run: apt update && apt install git -y
- uses: actions/checkout@v2 - uses: actions/checkout@v2
# create unity activation file and store to artifacts.
- run: /opt/Unity/Editor/Unity -quit -batchmode -nographics -logFile -createManualActivationFile || exit 0
- uses: actions/upload-artifact@v1
with:
name: Unity_v${{ matrix.unity }}.alf
path: ./Unity_v${{ matrix.unity }}.alf
# activate Unity from manual license file(ulf)
- run: echo -n "$UNITY_LICENSE" >> .Unity.ulf - run: echo -n "$UNITY_LICENSE" >> .Unity.ulf
env: env:
UNITY_LICENSE: ${{ secrets[matrix.license] }} UNITY_LICENSE: ${{ secrets[matrix.license] }}

View File

@ -34,6 +34,7 @@ Techinical details, see blog post: [UniTask v2 — Zero Allocation async/await f
- [For Unit Testing](#for-unit-testing) - [For Unit Testing](#for-unit-testing)
- [Compare with Standard Task API](#compare-with-standard-task-api) - [Compare with Standard Task API](#compare-with-standard-task-api)
- [Pooling Configuration](#pooling-configuration) - [Pooling Configuration](#pooling-configuration)
- [Allocation on Profiler](#allocation-on-profiler)
- [UniTaskSynchronizationContext](#unitasksynchronizationcontext) - [UniTaskSynchronizationContext](#unitasksynchronizationcontext)
- [API References](#api-references) - [API References](#api-references)
- [UPM Package](#upm-package) - [UPM Package](#upm-package)
@ -151,12 +152,12 @@ UniTask provides three pattern of extension methods.
> Note: WithCancellation is returned from native timing of PlayerLoop but ToUniTask is returned from specified PlayerLoopTiming. Details of timing, see: [PlayerLoop](#playerloop) section. > Note: WithCancellation is returned from native timing of PlayerLoop but ToUniTask is returned from specified PlayerLoopTiming. Details of timing, see: [PlayerLoop](#playerloop) section.
> Note: AssetBundleRequest has `asset` and `allAssets`, in default await returns `asset`. If you want to get `allAssets`, you can use `AwaitForAllAssets()` method.
The type of `UniTask` can use utility like `UniTask.WhenAll`, `UniTask.WhenAny`. It is like Task.WhenAll/WhenAny but return type is more useful, returns value tuple so can deconsrtuct each result and pass multiple type. The type of `UniTask` can use utility like `UniTask.WhenAll`, `UniTask.WhenAny`. It is like Task.WhenAll/WhenAny but return type is more useful, returns value tuple so can deconsrtuct each result and pass multiple type.
```csharp ```csharp
public class SceneAssets public async UniTaskVoid LoadManyAsync()
{
public SceneAssets()
{ {
// parallel load. // parallel load.
var (a, b, c) = await UniTask.WhenAll( var (a, b, c) = await UniTask.WhenAll(
@ -170,7 +171,6 @@ public class SceneAssets
var resource = await Resources.LoadAsync<Sprite>(path); var resource = await Resources.LoadAsync<Sprite>(path);
return (resource as Sprite); return (resource as Sprite);
} }
}
``` ```
If you want to convert callback to UniTask, you can use `UniTaskCompletionSource<T>` that is the lightweight edition of `TaskCompletionSource<T>`. If you want to convert callback to UniTask, you can use `UniTaskCompletionSource<T>` that is the lightweight edition of `TaskCompletionSource<T>`.
@ -835,7 +835,15 @@ foreach (var (type, size) in TaskPool.GetCacheSizeInfo())
} }
``` ```
> In UnityEditor profiler shows allocation of compiler generated AsyncStateMachine but it only occurs in debug(development) build. C# Compiler generate AsyncStateMachine as class on Debug build and as struct on Release build. Allocation on Profiler
---
In UnityEditor profiler shows allocation of compiler generated AsyncStateMachine but it only occurs in debug(development) build. C# Compiler generate AsyncStateMachine as class on Debug build and as struct on Release build.
After Unity 2020.1 supports Code Optimization option on UnityEditor(right, footer).
![](https://user-images.githubusercontent.com/46207/89967342-2f944600-dc8c-11ea-99fc-0b74527a16f6.png)
You can change C# compiler optimization to release, it removes AsyncStateMachine allocation. Andalso optimization option can set via `Compilation.CompilationPipeline-codeOptimization`, and `Compilation.CodeOptimization`.
UniTaskSynchronizationContext UniTaskSynchronizationContext
--- ---