Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  3. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Async Await Support Ready

Discussion in 'Experimental Scripting Previews' started by jGate99, May 19, 2018.

  1. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,936
    Hi there,

    I want to use Async Await for multithreading however im not sure if it is ready for production or not. So few questions:
    1- Will async await generate garabage like courtines does?
    2- Can i use it for IL2CP based crossplatform game that will work on iOS, Android, Windows, and UWP?

    Anything to be aware of before i switch my code from courtines to Async?

    Thanks
     
  2. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,921
    In our experience, async/await does more allocations than coroutines. You should profile your case to be sure, but generally it is not kind to the GC.

    Yes, as long as you are using 2018.1 with the new scripting runtime, async/await will work on all of these platforms with IL2CPP. Note that you should use the .NET Standard 2.0 Api Compatibility Level to ensure the best chance your code will work on all platforms Unity supports.
     
    khaled24 likes this.