Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add AsyncInstantiate support #548

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ilakhin
Copy link

@ilakhin ilakhin commented Feb 17, 2024

@neuecc
Copy link
Member

neuecc commented Feb 19, 2024

What is UNITASK_ASYNCINSTANTIATE_SUPPORT?

@ilakhin
Copy link
Author

ilakhin commented Feb 19, 2024

AsyncInstantiateOperation was added since Unity 2022.3.20 / 2023.3.0b7:

I didn't find a define like UNITY_2022_3_20_OR_NEWER to restrict the methods.

@timcassell
Copy link

timcassell commented Feb 19, 2024

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

@ilakhin
Copy link
Author

ilakhin commented Feb 19, 2024

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).
image

@timcassell
Copy link

Oh I missed it in the notes because of the weird formatting. Player: Added: Object.InstantiateAsync<T>().... Ugh, Unity doing stupid things so much.

@Torgo13
Copy link

Torgo13 commented Mar 4, 2024

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.

@nansofting
Copy link

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)

@xtutu
Copy link

xtutu commented May 16, 2024

is there any progress? we need it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants