From 1d90a40f6697140139b8b64977f5fba63d85b298 Mon Sep 17 00:00:00 2001 From: neuecc Date: Thu, 4 Jun 2020 17:53:57 +0900 Subject: [PATCH] more ReadMe --- README.md | 17 ++++++++++++++++- src/UniTask/Assets/Scenes/SandboxMain.cs | 5 +++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 11790db..cccfd88 100644 --- a/README.md +++ b/README.md @@ -324,6 +324,10 @@ It indicates when to run, you can check [PlayerLoopList.md](https://gist.github. `PlayerLoopTiming.FixedUpdate` is similar as `WaitForFixedUpdate`, `PlayerLoopTiming.LastPostLateUpdate` is similar as `WaitForEndOfFrame` in coroutine. +In stacktrace, you can check where is running in playerloop. + +![image](https://user-images.githubusercontent.com/46207/83735571-83caea80-a68b-11ea-8d22-5e22864f0d24.png) + In default, UniTask's PlayerLoop is initialized at `[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]`. The order in which methods are called in BeforeSceneLoad is indeterminate, so if you want to use UniTask in other BeforeSceneLoad methods, you should try to initialize it before this. @@ -413,7 +417,7 @@ For debug use, enable tracking and capture stacktrace is useful but it it declin External Assets --- -In default, UniTask supports DOTween and Addressable(`AsyncOperationHandle` and `AsyncOpereationHandle` as awaitable). +In default, UniTask supports DOTween and Addressables(`AsyncOperationHandle` and `AsyncOpereationHandle` as awaitable). For DOTween support, require to `com.demigiant.dotween` import from [OpenUPM](https://openupm.com/packages/com.demigiant.dotween/) or define `UNITASK_DOTWEEN_SUPPORT` to enable it. @@ -649,6 +653,17 @@ public IEnumerator DelayIgnore() => UniTask.ToCoroutine(async () => UniTask itself's unit test is written by Unity Test Runner and [Cysharp/RuntimeUnitTestToolkit](https://github.com/Cysharp/RuntimeUnitTestToolkit) to check on CI and IL2CPP working. +Pooling Configuration +--- +UniTask is aggressively caching async promise object to achive zero allocation. In default, cache all promises but you can configure `TaskPool.SetMaxPoolSize` to your value, the value indicates cache size per type. `TaskPool.GetCacheSizeInfo` returns current cached object in pool. + +```csharp +foreach (var (type, size) in TaskPool.GetCacheSizeInfo()) +{ + Debug.Log(type + ":" + size); +} +``` + API References --- UniTask's API References is hosted at [cysharp.github.io/UniTask](https://cysharp.github.io/UniTask/api/Cysharp.Threading.Tasks.html) by [DocFX](https://dotnet.github.io/docfx/) and [Cysharp/DocfXTemplate](https://github.com/Cysharp/DocfxTemplate). diff --git a/src/UniTask/Assets/Scenes/SandboxMain.cs b/src/UniTask/Assets/Scenes/SandboxMain.cs index 28326be..9a08762 100644 --- a/src/UniTask/Assets/Scenes/SandboxMain.cs +++ b/src/UniTask/Assets/Scenes/SandboxMain.cs @@ -389,6 +389,11 @@ public class SandboxMain : MonoBehaviour Debug.Log("Yeha"); })); + foreach (var (type, size) in TaskPool.GetCacheSizeInfo()) + { + Debug.Log(type + ":" + size); + } + //}).Forget();