mirror of
https://github.com/Cysharp/UniTask.git
synced 2026-05-18 21:20:10 +00:00
Compare commits
3 Commits
test_il2cp
...
2.0.15
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
80704e489d | ||
|
|
3c0aa03643 | ||
|
|
37cd00d347 |
@@ -690,6 +690,8 @@ 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. And also currently due to IL2CPP limitation, in IL2CPP build, UniTask do boxing AsyncStateMachine when needed so sometimes exists `one` allocation.
|
||||
|
||||
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).
|
||||
|
||||
@@ -45,7 +45,11 @@ namespace Cysharp.Threading.Tasks.CompilerServices
|
||||
{
|
||||
static TaskPool<AsyncUniTaskVoid<TStateMachine>> pool;
|
||||
|
||||
#if ENABLE_IL2CPP
|
||||
IAsyncStateMachine stateMachine; // unfortunatelly boxed to fix IL2CPP issue.
|
||||
#else
|
||||
TStateMachine stateMachine;
|
||||
#endif
|
||||
|
||||
public Action MoveNext { get; }
|
||||
|
||||
@@ -113,7 +117,11 @@ namespace Cysharp.Threading.Tasks.CompilerServices
|
||||
{
|
||||
static TaskPool<AsyncUniTask<TStateMachine>> pool;
|
||||
|
||||
#if ENABLE_IL2CPP
|
||||
IAsyncStateMachine stateMachine; // unfortunatelly boxed to fix IL2CPP issue.
|
||||
#else
|
||||
TStateMachine stateMachine;
|
||||
#endif
|
||||
|
||||
public Action MoveNext { get; }
|
||||
|
||||
@@ -224,7 +232,11 @@ namespace Cysharp.Threading.Tasks.CompilerServices
|
||||
{
|
||||
static TaskPool<AsyncUniTask<TStateMachine, T>> pool;
|
||||
|
||||
#if ENABLE_IL2CPP
|
||||
IAsyncStateMachine stateMachine; // unfortunatelly boxed to fix IL2CPP issue.
|
||||
#else
|
||||
TStateMachine stateMachine;
|
||||
#endif
|
||||
|
||||
public Action MoveNext { get; }
|
||||
|
||||
@@ -245,7 +257,8 @@ namespace Cysharp.Threading.Tasks.CompilerServices
|
||||
|
||||
runnerPromiseFieldRef = result; // set runner before copied.
|
||||
result.stateMachine = stateMachine; // copy struct StateMachine(in release build).
|
||||
UnityEngine.Debug.Log($"SetStateMachine State:" + StateMachineUtility.GetState(stateMachine));
|
||||
|
||||
// UnityEngine.Debug.Log($"SetStateMachine State:" + StateMachineUtility.GetState(stateMachine));
|
||||
}
|
||||
|
||||
|
||||
@@ -268,7 +281,7 @@ namespace Cysharp.Threading.Tasks.CompilerServices
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
void Run()
|
||||
{
|
||||
UnityEngine.Debug.Log($"MoveNext State:" + StateMachineUtility.GetState(stateMachine));
|
||||
// UnityEngine.Debug.Log($"MoveNext State:" + StateMachineUtility.GetState(stateMachine));
|
||||
stateMachine.MoveNext();
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Cysharp.Threading.Tasks.Linq
|
||||
{
|
||||
internal static async UniTask<TSource[]> ToArrayAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, CancellationToken cancellationToken)
|
||||
{
|
||||
UnityEngine.Debug.Log("Called ToArray");
|
||||
// UnityEngine.Debug.Log("Called ToArray");
|
||||
|
||||
var pool = ArrayPool<TSource>.Shared;
|
||||
var array = pool.Rent(16);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "com.cysharp.unitask",
|
||||
"displayName": "UniTask",
|
||||
"version": "2.0.14",
|
||||
"version": "2.0.15",
|
||||
"unity": "2018.4",
|
||||
"description": "Provides an efficient async/await integration to Unity.",
|
||||
"keywords": [ "async/await", "async", "Task", "UniTask" ],
|
||||
|
||||
@@ -413,6 +413,19 @@ public class SandboxMain : MonoBehaviour
|
||||
Debug.Log("after");
|
||||
}
|
||||
|
||||
private async UniTaskVoid ExecuteAsync()
|
||||
{
|
||||
Debug.Log("1");
|
||||
{
|
||||
var xs = await UniTaskAsyncEnumerable.TimerFrame(1).ToArrayAsync();
|
||||
}
|
||||
Debug.Log("------------------");
|
||||
{
|
||||
var xs = await UniTaskAsyncEnumerable.TimerFrame(1).ToArrayAsync();
|
||||
Debug.Log("2");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Start()
|
||||
{
|
||||
@@ -423,7 +436,7 @@ public class SandboxMain : MonoBehaviour
|
||||
|
||||
//StartCoroutine(TestCoroutine().ToCoroutine());
|
||||
|
||||
Application.logMessageReceived += Application_logMessageReceived;
|
||||
// Application.logMessageReceived += Application_logMessageReceived;
|
||||
|
||||
|
||||
|
||||
@@ -432,13 +445,9 @@ public class SandboxMain : MonoBehaviour
|
||||
|
||||
okButton.onClick.AddListener(UniTask.UnityAction(async () =>
|
||||
{
|
||||
{
|
||||
var xs = await UniTaskAsyncEnumerable.TimerFrame(1).ToArrayAsync();
|
||||
}
|
||||
Debug.Log("------------------");
|
||||
{
|
||||
var xs = await UniTaskAsyncEnumerable.TimerFrame(1).ToArrayAsync();
|
||||
}
|
||||
_ = ExecuteAsync();
|
||||
|
||||
await UniTask.Yield();
|
||||
|
||||
//await DelayCheck();
|
||||
/*
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,7 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 370f60b2e4cd92d4faafda153c9c5f8a
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user