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

Will 2017.1 support async/await on XBox One?

Discussion in 'Experimental Scripting Previews' started by CswiedlerTrion, Apr 6, 2017.

  1. CswiedlerTrion

    CswiedlerTrion

    Joined:
    Dec 6, 2014
    Posts:
    15
    I was hoping to use alexzzzz's c# 6 compiler support to let us start using async/await before 2017.1 comes out, but apparently the code generated by the Roslyn compiler he uses doesn't work with aot-only.

    Will there be a similar limitation with Unity's official support for C# 6? I.e. will we be able to use async/await on Xbox One?
     
  2. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,937
    This limitation should not exist. Even in 5.6, you can use .NET 4.6 with IL2CPP on Xbox One. The async/await system should work there. You will need to provide your own synchronization context though. In 2017.1, with the new runtime support enabled, Unity provides a default synchronization context.
     
  3. CswiedlerTrion

    CswiedlerTrion

    Joined:
    Dec 6, 2014
    Posts:
    15
    I guess I'm misunderstanding, then. Do you mean that 5.6 introduces .NET 4.6 support, but only for IL2CPP, and 2017.1 will introduce .NET 4.6 for mono?
     
  4. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,937
    In Unity 5.6 we shipped support for .NET 4.6 with IL2CPP on the Xbox One and Windows Store platforms only. Even the Unity editor does not support .NET 4.6.

    In Unity 2017.1 there is support for .NET 4.6 many more places, including the editor, standalones, mobiles. But Unity 2017.1 does not bring .NET 4.6 support for Mono on Xbox One. In generally, we're planning to only support .NET 4.6 AOT via IL2CPP.

    This can be a bit confusing during the transition. Longer term, Unity will always support the latest .NET version, with JIT code generation provided by Mono and AOT code generation provided by IL2CPP.
     
    ThainaYu likes this.
  5. CswiedlerTrion

    CswiedlerTrion

    Joined:
    Dec 6, 2014
    Posts:
    15
    Thanks. When you say the editor doesn't even support .NET 4.6 (but IL2CPP for Xbox One does), how does that work? Do we have to #ifdef all .NET 4.6 stuff for !UNITY_EDITOR?
     
  6. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    That's correct. Or use "#if NET_4_6". You can call into Xbox winmd files too.

    Read more here:

    https://docs.unity3d.com/Manual/IL2CPP-WindowsRuntimeSupport.html

    If you want to discuss certain Xbox One API in detail, post on the Xbox One forum since a lot of that stuff is under NDA. If you want to discuss general mechanism on how it works, we can do it here since it works exactly the same way on both Windows Store and Xbox One.