UniTask
UniTask copied to clipboard
Add AsyncInstantiate support
https://docs.unity3d.com/2023.3/Documentation/ScriptReference/AsyncInstantiateOperation_1.html
What is UNITASK_ASYNCINSTANTIATE_SUPPORT
?
AsyncInstantiateOperation was added since Unity 2022.3.20 / 2023.3.0b7:
- https://unity.com/releases/editor/whats-new/2022.3.20
- https://unity.com/releases/editor/beta
I didn't find a define like UNITY_2022_3_20_OR_NEWER to restrict the methods.
Unity doesn't add new APIs in patch versions. It was added in 2022.3.0, so you can use UNITY_2022_3_OR_NEWER.
https://docs.unity3d.com/2023.3/Documentation/ScriptReference/AsyncInstantiateOperation_1.html
Unity 2022.3.19f1 does not support this API. It was added in a patch version (https://unity.com/releases/editor/whats-new/2022.3.20).
Oh I missed it in the notes because of the weird formatting. Player: Added: Object.InstantiateAsync<T>().
... Ugh, Unity doing stupid things so much.
There is a new define in 2022.3.20f1 that can be used instead of #if UNITASK_ASYNCINSTANTIATE_SUPPORT: #if UNITY_2022_3_20
I assume it's supposed to be #if UNITY_2022_3_20_OR_NEWER, but we'll know for sure once 2022.3.21f1 comes out.
I've come up with the following define. It's not elegant but it does what you want.
// 2022.3.20f1 or newer
#if UNITY_2022_3_OR_NEWER && !(UNITY_2022_3_0 || UNITY_2022_3_1 || UNITY_2022_3_2 || UNITY_2022_3_3 || UNITY_2022_3_4 || UNITY_2022_3_5 || UNITY_2022_3_6 || UNITY_2022_3_7 || UNITY_2022_3_8 || UNITY_2022_3_9 || UNITY_2022_3_10 || UNITY_2022_3_11 || UNITY_2022_3_12 || UNITY_2022_3_13 || UNITY_2022_3_14 || UNITY_2022_3_15 || UNITY_2022_3_16 || UNITY_2022_3_17 || UNITY_2022_3_18 || UNITY_2022_3_19)
is there any progress? we need it
What's the expected behaviour when the extensions introduced in this PR are used with an AsyncInstantiateOperation
with the allowSceneActivation
flag set to false? From what I have understood looking at the code the task would never complete.