Search Unity

  1. Unity 2019.1 is now released.
    Dismiss Notice

Entities and Api compatibility level .Net Standard 2.0. errors in console

Discussion in 'Entity Component System and C# Job system' started by luvjungle, Jul 12, 2018.

  1. luvjungle

    luvjungle

    Joined:
    Dec 18, 2017
    Posts:
    15
    After switching to api compatibility level .Net Standard 2.0 (from 4.X) I got a lot of errors in console pointing to
    C:/Users/luvju/AppData/Local/Unity/cache/packages/packages.unity.com/com.unity.entities@0.0.12-preview.8/Unity.Entities.Properties/

    e.g.
    C:/Users/luvju/AppData/Local/Unity/cache/packages/packages.unity.com/com.unity.entities@0.0.12-preview.8/Unity.Entities.Properties/TypeInformation.cs(291,17): error CS0103: The name 'RefAccess' does not exist in the current context

    I tried to clear cache and reimport assets, but it didn't help.
    Please help to fix this
     
    Last edited: Jul 12, 2018
  2. zulfajuniadi

    zulfajuniadi

    Joined:
    Nov 18, 2017
    Posts:
    117
    You need to set .net 4.x to use the ECS and Incremental Compiler packages
     
  3. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    1,154
    as zulfajuniadi stated, .net 4.x is a requirement of the entities package.
     
  4. luvjungle

    luvjungle

    Joined:
    Dec 18, 2017
    Posts:
    15
  5. M_R

    M_R

    Joined:
    Apr 15, 2015
    Posts:
    394
    I think packages from Unity should be compatible with .NETStandard
    especially since they are pushing for smaller runtime size
     
    andrzej_cadp likes this.
  6. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    1,154
    Burst, ecs, jobs simply can't work with .net3.5 (.net standard 2.0)
     
  7. M_R

    M_R

    Joined:
    Apr 15, 2015
    Posts:
    394
    .net standard is not 3.5:
    • 3.5 is the old runtime
    • 4.6 is the new runtime. it has 2 options for api compatibilty level:
      • "full" .net framework 4.6 (has all the APIs in .net, but is heavier and not everything may be supported on all platforms)
      • .net standard 2.0 (it's designed to be lighter and fully cross-platform compatible, but it may not have some fringe APIs)
    c# version is completely parallel to that (you can use some c#6 features in .net 3.5 like expression-bodied methods if you enable the compiler flag, and the incremental compiler enables c#7 in the .net 4.6 runtime)

    old runtime also had the api compatibilty level option (.net 2.0 vs subset) except subset was arbitrary and broke almost every 3rd party library (e.g. json.net)
    .net standard is (wait for it) a standard so most 3rd party libraries are expected to work with it
     
    andrzej_cadp likes this.