Cysharp/UniTask

[BUG; CRITICAL] Wrong assetReference.InstantiateAsync(parent).ToUniTask(cancellationToken: token) result

truenoob141 opened this issue · 3 comments

I want to spawn 'TutorialMessageView' prefab via next code:

var go = await assetReference.InstantiateAsync(parent)
    .ToUniTask(cancellationToken: token);
            
Debug.LogWarning($"Loaded {go.name}, Must be {typeof(T).Name}");

Before await:
unitask_bug_01

After:
unitask_bug_02

Result is wrong.

Native tasks work correctly:

var op = assetReference.InstantiateAsync(parent);
var go = await op.Task;
token.ThrowIfCancellationRequested();

Debug.LogWarning($"Loaded {go.name}, Must be {typeof(T).Name}");