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. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  3. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Official Blog post: Porting Unity to CoreCLR

Discussion in 'Experimental Scripting Previews' started by JoshPeterson, Oct 23, 2023.

  1. CaseyHofland

    CaseyHofland

    Joined:
    Mar 18, 2016
    Posts:
    621
    That’s fair: Unity plans to become a “first class residence” of .NET with this improvement so it should mean they will become a first class .NET application as well.

    You still need to use the IL2CPP compiler for iPhone platforms but that shouldn’t be a problem. Then again: would love a fact check.
     
  2. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,938
    At least for our first release, I don't expect that we will explicitly support AssemblyLoadContext in player builds. Our focus currently is on using AssemblyLoadContext as an implementation for code reload in the Unity Editor (similar to how app domains are used now).

    For players using the CoreCLR runtime (desktop standalone players), I would expect AssemblyLoadContext to work without any special changes. We're working hard to make sure that we don't prevent it from working, although Unity itself will likely not use this feature.

    For player using IL2CPP runtime, the story is a bit more foggy. Initially, IL2CPP won't be able to load and unload assemblies. Even in current Unity versions, IL2CPP compiles all code from all assemblies into one executable, so there is not really a concept of assembly loading (IL2CPP kind of "fakes" those APIs now). But I could see a future where IL2CPP could compile each .NET assembly to a dynamic library for platforms where dynamic libraries are supported. So that is not out of the question, but it is not something we are actively working on.
     
  3. Enkianthus

    Enkianthus

    Joined:
    Mar 28, 2022
    Posts:
    20
    When Unity 6 is officially released, is there hope that the migration to CoreCLR will be completed, or will we have to wait until some time afterward?
     
  4. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,524
  5. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,938
    We don't have an ETA to discuss publicly yet. That forum thread linked by @mgear is the best place to watch for updates though.
     
  6. Artemko_one

    Artemko_one

    Joined:
    Jan 3, 2018
    Posts:
    6
    Could it be that coreCLR will be more (or equal) performant than IL2CPP in game builds on some platforms?

    If yes and if NativeAOT would be supported, could it be that IL2CPP won't be needed anymore?
     
  7. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,938
    You can find a lot of discussion about this on the recent posts on this thread: https://forum.unity.com/threads/unity-future-net-development-status.1092205

    I suspect the CoreCLR will get better performance that IL2CPP for many scenarios. We're not actively working on NativeAOT support now, but it is something we are considering for the future.
     
    AetherMFP and Artemko_one like this.