Search Unity

Official Experimental Entities 0.50 is Available

Discussion in 'Entity Component System' started by mfuad, Mar 16, 2022.

Thread Status:
Not open for further replies.
  1. Extrys

    Extrys

    Joined:
    Oct 25, 2017
    Posts:
    345
    I could investigate that package and see if thats whats causing the problem, thanks!
     
    Thygrrr likes this.
  2. genaray

    genaray

    Joined:
    Feb 8, 2017
    Posts:
    191
    Im using the latest 2020 lts version ( downloaded yesterday ) and upgraded to the latest entities preview version...
    However... i get 138 errors inside the entities package.

    upload_2022-3-25_17-37-54.png

    Especially inside the sub editor package. Besides that, i receive an job related error when i try to schedule parallel an job


    Code (CSharp):
    1. protected override void OnUpdate() {
    2.  
    3.     var ecb = atFrameStartBuffer.CreateCommandBuffer();
    4.     var ecbParallel = atFrameStartBuffer.CreateCommandBuffer().AsParallelWriter();
    5.  
    6.     var addedEntityCount = newEntities.CalculateEntityCount();
    7.     var removedEntityCound = entitiesWithStateOnly.CalculateEntityCount();
    8.  
    9.     var added = new NativeList<Transmution>(addedEntityCount, Allocator.TempJob);
    10.     var removed = new NativeList<Transmution>(removedEntityCound, Allocator.TempJob);
    11.  
    12.     // Add the added component job
    13.     var addedJob = new AddedJob{
    14.         ecb = ecbParallel,
    15.         entityHandle = GetEntityTypeHandle(),
    16.         componentHandle = GetComponentTypeHandle<TComponent>(true),
    17.         added = added.AsParallelWriter()
    18.     };
    19.     addedJob.ScheduleParallel(newEntities, Dependency).Complete();  // The error above happens
    20. }
    Any one having an idea why this might happen ? ( I followed the upgrade guide )
     
    Last edited: Mar 25, 2022
  3. DevViktoria

    DevViktoria

    Joined:
    Apr 6, 2021
    Posts:
    94
    AFAIK the Entities 0.50 work with the 2020.3.30f1 version which is not the latest. (At the time of writing the latest version is 2020.3.32f1.) You can download the correct version from here: https://unity3d.com/get-unity/download/archive
     
    genaray likes this.
  4. genaray

    genaray

    Joined:
    Feb 8, 2017
    Posts:
    191
    Wait... does this mean that entities 0.50 works with 2020.3.30f1 but not with 2020.3.32f1 ????
    However this doesnt solve the issue... i have several mates using the 3.32f1 version and it works for them.
     
    Last edited: Mar 25, 2022
    DevViktoria and Filimindji like this.
  5. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,129
    I'm using 2020.3.32f1. No issue so far.
     
    DevViktoria and Anthiese like this.
  6. eatbuckshot

    eatbuckshot

    Joined:
    Jan 10, 2016
    Posts:
    24
    Does Entities 0.50.0 and Hybrid Rendering work when built for WebGL platform?
     
  7. jpvanoosten

    jpvanoosten

    Joined:
    Nov 20, 2009
    Posts:
    50
    I don't know if this is the right place to post bugs, and I've tried searching this forum for a solution but to no avail.

    I've tried upgrading the Jobs package in my project to 0.50.0-preview.8 and started getting the following error when using
    IJobParallelForBatch
    :

    Reflection data was not set up by an Initialize() call

    Reverting to 0.11.0-preview.6 resolves the issue so I assume it's a bug in 0.50.0-preview.8.

    I've setup a GitHub repo that can be used to test and reproduce the issue: https://github.com/jpvanoosten/ParallelReduce
     
  8. AnneAtMarel

    AnneAtMarel

    Joined:
    Mar 9, 2022
    Posts:
    2
    This version (0.51) will be the update I am waiting for (until 1.0 of course)!
     
  9. elliotc-unity

    elliotc-unity

    Unity Technologies

    Joined:
    Nov 5, 2015
    Posts:
    230
    @jpvanoosten It's because you're using generic jobs whose generic instantiations are not explicitly referenced in the code. Add assembly attributes at the top of your file like so for each generic instantiation you need to use:


    [assembly: RegisterGenericJobType(typeof(ParallelReduceJob<int, float>))]
    [assembly: RegisterGenericJobType(typeof(Unity.Jobs.Tests.ManagedJobs.MyGenericJobDefer<double>))]
    [assembly: RegisterGenericJobType(typeof(Unity.Jobs.Tests.ManagedJobs.MyGenericJobDefer<float>))]

    etc.

    I'll try to figure out how to improve the error message in the meantime.

    (It kind of sucks that it has to be this way, but if we didn't require this, we would have to scan all over the place extremely expensively on every compile to figure out all the possible generic instantiations, and then iteration time would get way way way worse.)
     
    bb8_1 likes this.
  10. DreamingImLatios

    DreamingImLatios

    Joined:
    Jun 3, 2017
    Posts:
    4,264
    @jpvanoosten You can also follow the patterns to get automatic registration as outlined in this document: https://docs.unity3d.com/Packages/com.unity.entities@0.50/manual/ecs_generic_jobs.html
    as well as this document: https://docs.unity3d.com/Packages/c...docs/OptimizationGuidelines.html#generic-jobs
    Or if you want a really clean API, follow the pattern I discovered here: https://github.com/Dreaming381/BurstGenericsTest
    SortJob in the Collections package follows the same pattern.
     
    bb8_1 and Occuros like this.
  11. Jonny-Roy

    Jonny-Roy

    Joined:
    May 29, 2013
    Posts:
    666
    Could we not just have an IJobParallelForBatchPreInitialised or something?

    I mean at least we have a work around, but it kind of feels like a work around rather than a solution.
     
    bb8_1 likes this.
  12. mfuad

    mfuad

    Unity Technologies

    Joined:
    Jun 12, 2018
    Posts:
    335
    No, the hybrid renderer is designed to require compute shaders for optimal performance.
     
    hippocoder likes this.
  13. mfuad

    mfuad

    Unity Technologies

    Joined:
    Jun 12, 2018
    Posts:
    335
    Entities 0.50 is compatible with Unity 2020 LTS (min. version Unity 2020.3.30). So it's expected to work with later patch releases beyond Unity 2020.3.30. Will update the forum post and our documentation to make this more clear.
     
    JesOb, PhilSA, DevViktoria and 2 others like this.
  14. Armitage1982

    Armitage1982

    Joined:
    Jul 26, 2012
    Posts:
    38
    Did you find anything interesting about the CodeGen issue?
    As I'm stuck with 2021.2, it's tempting to wait for 0.51, but since it's scheduled between May and August, I'd like to know if it's worth the wait.
    Thanks
     
  15. BelkinAlex

    BelkinAlex

    Joined:
    Sep 28, 2015
    Posts:
    9
    Try short path for install folder editor.
     
  16. rlabrecque

    rlabrecque

    Joined:
    Aug 27, 2014
    Posts:
    15
    Are there any updated guides/tutorials/samples/best practice resources with the 0.50 API yet?
     
  17. Occuros

    Occuros

    Joined:
    Sep 4, 2018
    Posts:
    300
    rlabrecque likes this.
  18. gato0429

    gato0429

    Joined:
    Mar 5, 2015
    Posts:
    22
    hello,

    Has anyone tried to instantiate an entity from pure code, and add a mesh render to it?

    I have the problem that despite adding all the components, which the entity requires to render the mesh, it does not render.

    Formerly with entities version 0.17 preview.42, and hybrid render 0.11.0 preview.44 I had no problems.
    I've tried instantiating both with urp and without urp, but I can't render the mesh in the game window.

    Does anyone know if I should add other components to the entity, or what I might be doing wrong?

    upload_2022-4-3_22-1-20.png

    upload_2022-4-3_22-2-41.png
    upload_2022-4-3_22-3-23.png

    Thank you
     
  19. Shinyclef

    Shinyclef

    Joined:
    Nov 20, 2013
    Posts:
    505
    I haven't used 0.50 as I'm still on 2021, but I suggest a few things.
    1. Inspect what components are on an entity that is instantiated from a GameObject prefab with ConvertToEntiy to see what's different.
    2. Use RenderMeshUtility.AddComponents instead of adding all component manually.
    3. Convert your workflow to use authoring as that's where 1.0 workflows seem to be heading towards.
     
  20. TieSKey

    TieSKey

    Joined:
    Apr 14, 2011
    Posts:
    225
    Exactly what Shinyclef said, I just wanted to add u should take that approach for physics entities if u are using them.
    The biggest drawback of composition over inheritance (looking at ECS as "pure" composition) is that there is no explicit, language enforced way to check which components a system needs.

    A reasonable workaround from Unity would be to make a bunch of prototypes available from a global provider.
     
  21. Fribur

    Fribur

    Joined:
    Jan 5, 2019
    Posts:
    136
    Yes, working just fine, but for some strange reason you have to change the layermask property of the RenderMesh to “1” now.
     
    gato0429 likes this.
  22. gato0429

    gato0429

    Joined:
    Mar 5, 2015
    Posts:
    22
    You are absolutely right, thank you very much, I had overlooked the layermask part. thank you

    :):)
     
  23. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,129
    @elliotc-unity @mfuad Currently seems like ISharedComponentData still can't be bursted. Will it be supported at 0.51?

    (0,0): Burst error BC1051: Invalid managed type found for the field `EqualFn` of the struct `Unity.Entities.FastEquality.TypeInfo`.: the type `System.Delegate` is a managed type and is not supported
    at Unity.Entities.FastEquality.GetHashCode(void* dataPtr, Unity.Entities.FastEquality.TypeInfo typeInfo) (at C:\Project\Library\PackageCache\com.unity.entities@8e13422a93\Unity.Entities\Types\FastEquality.cs:201)
    at Unity.Entities.FastEquality.GetHashCode(Unity.Physics.PhysicsWorldIndex lhs, Unity.Entities.FastEquality.TypeInfo typeInfo) (at C:\Project\Library\PackageCache\com.unity.entities@8e13422a93\Unity.Entities\Types\FastEquality.cs:192)
    at Unity.Entities.TypeManager.GetHashCode(ref Unity.Physics.PhysicsWorldIndex val) (at C:\Project\Library\PackageCache\com.unity.entities@8e13422a93\Unity.Entities\Types\TypeManager.cs:760)
    at Unity.Entities.EntityCommandBuffer.IsDefaultObject(ref Unity.Physics.PhysicsWorldIndex component, ref int hashCode) (at C:\Project\Library\PackageCache\com.unity.entities@8e13422a93\Unity.Entities\EntityCommandBuffer.cs:2188)
    at Unity.Entities.EntityCommandBuffer.AddSharedComponent(Unity.Entities.EntityCommandBuffer* this, Unity.Entities.Entity e, Unity.Physics.PhysicsWorldIndex component) (at C:\Project\Library\PackageCache\com.unity.entities@8e13422a93\Unity.Entities\EntityCommandBuffer.cs:2207)
     
    Last edited: Apr 7, 2022
  24. davenirline

    davenirline

    Joined:
    Jul 7, 2010
    Posts:
    982
    I don't think it will ever be supported as there shouldn't be managed code in Burst environment.
     
  25. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,759
    They're releasing unmanaged shared components in the future
    https://docs.unity3d.com/Packages/com.unity.entities@0.50/manual/shared_component_data.html
     
    Occuros, davenirline and Anthiese like this.
  26. mikaelK

    mikaelK

    Joined:
    Oct 2, 2013
    Posts:
    284
    I reported a bug where I moved ecs scene and scripts that was rendering properly in to a new project where it stopped rendering.

    Entities are there, but not rendering.
    Not sure if its related, but I was building the entities by code in an authoring component.

    If you happen to find out the reason would be nice to know. This is in 0.17 since 0.50 doesn't support 2021
     
  27. eizenhorn

    eizenhorn

    Joined:
    Oct 17, 2016
    Posts:
    2,684
    There is additional data for rendering layer you need to set. HR has utility for adding all required components. Also, are you sure new project has HR package installed?
     
  28. mikaelK

    mikaelK

    Joined:
    Oct 2, 2013
    Posts:
    284
    yes, the odd thing is that it renders in the editor just fine, but not in the build.
    The original project renders in the build and editor.

    Also the particle system from the prefabs work just fine. So you can see lots of missiles without hull.
     
  29. sheikhg1900

    sheikhg1900

    Joined:
    Sep 13, 2021
    Posts:
    8
    Android IL2CPP App still not working in this version. I tried with these packages.
    "com.unity.platforms": "0.50.0-preview.4",
    "com.unity.rendering.hybrid": "0.50.0-preview.24",
     
  30. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    Hi! I'm currently trying to upgrade a 2020.3.18, Entities 0.14 project to 0.50 and it looks like FixedRateUtils silently disappeared in 0.50. That class still existed in 0.17 and so far, I wasn't able to find any info on what became of it (and it's not mentioned in the 0.17 to 0.50 upgrade doc).

    Is there a replacement available? If not, how can we migrate code that relies on this existing?

    EDIT: Turns out that one issue that prevents easily adding a replacement to FixedRateUtils is that ComponentSystemGroup no longer has UpdateCallback, neither of those is mentioned in the upgrade doc.

    EDIT 2: Looks like this was replaced with RateManager (member of ComponentSystemGroup). I did RateManager.Timestep = Time.fixedDeltaTime; but I'm not quite sure that this fully replaces
    FixedRateUtils.EnableFixedRateWithCatchUp(this, UnityEngine.Time.fixedDeltaTime);
     
    Last edited: Apr 11, 2022
    Arnold_2013 likes this.
  31. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    A few steps further, I get quite a few of these:
    Temp\GeneratedCode\<pathToOurClasses>\<OneOfOurSystems__System_1156873174.g.cs(12,13): error CS0426: The type name 'Runtime' does not exist in the type 'System'
    Temp\GeneratedCode\<pathToOurClasses>\<OneOfOurSystems__System_1156873174.g.cs(12,13): error CS0426: The type name 'IntPtr' does not exist in the type 'System'


    Is there a way to make these assemblies available in that context?

    At first I thought I was just missing some imports / usings but the names are fully qualified (e.g. System.IntPtr someVariableName) so the issue is that the assembly isn't available.
     
  32. cort_of_unity

    cort_of_unity

    Unity Technologies

    Joined:
    Aug 15, 2018
    Posts:
    98
    Hello -- sorry for the lack of clear upgrade guidance here. The API did go through a number of changes, as you noticed. It looks like you've mostly ended up in the right place, though. If you're just trying to get the familiar Unity FixedUpdate() semantics for a system group, I'd suggest using the FixedStepSimulationSystemGroup in DefaultWorld.cs as a reference:

    Code (CSharp):
    1. public class FixedStepSimulationSystemGroup : ComponentSystemGroup
    2. {
    3.     /// <summary>
    4.     /// Set the timestep use by this group, in seconds. The default value is 1/60 seconds.
    5.     /// This value will be clamped to the range [0.0001f ... 10.0f].
    6.     /// </summary>
    7.     public float Timestep
    8.     {
    9.         get => RateManager != null ? RateManager.Timestep : 0;
    10.         set
    11.         {
    12.             if (RateManager != null)
    13.                 RateManager.Timestep = value;
    14.         }
    15.     }
    16.  
    17.     [Preserve]
    18.     public FixedStepSimulationSystemGroup()
    19.     {
    20.         float defaultFixedTimestep = 1.0f / 60.0f;
    21.         RateManager = new RateUtils.FixedRateCatchUpManager(defaultFixedTimestep);
    22.     }
    23. }
    24.  
    If you're trying to do something more exotic than that, let me know and I'll see if I can point you in the right direction!
     
    jashan, thelebaron and NotaNaN like this.
  33. alexandre-fiset

    alexandre-fiset

    Joined:
    Mar 19, 2012
    Posts:
    715
    See this. You'll have to avoid using "System" in your namespace names, or any namespace name that may clash with Unity ones. That is a big issue, one easily reproducible, but haven't been added to the upgrade guide.
     
    Last edited: Apr 11, 2022
    jashan and Anthiese like this.
  34. goodnewsjimdotcom

    goodnewsjimdotcom

    Joined:
    May 24, 2017
    Posts:
    342
    Does .5 fix the editor slowing down 1000 fold from the lamented Octoberish 2021 release?

    My editor is nearly unplayable still, but my standalone is fine.
     
  35. wechat_os_Qy03Mal2MhB3Rp7JyCd7SBJ-0

    wechat_os_Qy03Mal2MhB3Rp7JyCd7SBJ-0

    Joined:
    Feb 18, 2018
    Posts:
    1
    2021lts can use 0.17.0, but 0.50.0 not avaiable. When 2021 will be supported?
     
    mikaelK and bb8_1 like this.
  36. Antares_

    Antares_

    Joined:
    Oct 19, 2017
    Posts:
    4
    Unity 2021.3 has been released,when will Entities 0.51 be released?
     
  37. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,770
    Most likely it is safe to say, few months time. Do not expect anyone to give the estimate date. It will be ready when is ready.
     
    Anthiese and Opeth001 like this.
  38. Krajca

    Krajca

    Joined:
    May 6, 2014
    Posts:
    347
    AFAIK there is a loose deadline for 0.51 -> Q2 2022

    Here:
     
    Rupture13 likes this.
  39. runner78

    runner78

    Joined:
    Mar 14, 2015
    Posts:
    792
    If 0.51 is just a compatibility update, hopefully it shouldn't take too long. Especially when you consider that 2021 LTS is based on 2021.2 and that has been realeasd almost half a year ago.
     
    Antares_ and Anthiese like this.
  40. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,770
    It loose as a sand. :)

    @runner78 There are significant differences as far I am awere between 2020 and 2021. And keep it mind, officially DOTSp specifically ECS packages are not even supported for 2021.
    It happens that people found specific packages, that still works for 2021. So it is not as that simple.

    If we get it in Q2, we are lucky in my opinion. And that would be great.
    I am personally not holding a breath, while I am on 2021.
     
    Anthiese likes this.
  41. CookieStealer2

    CookieStealer2

    Joined:
    Jun 25, 2018
    Posts:
    119
    How did you instantiate with burst in a job without EET? Did you run with safety checks off? For me when I try to instantiate, the internal code attempts to dispose an AtomicSafetyHandle, but then an exception is thrown because it is not allowed to dispose in jobs.
     
  42. nikk98

    nikk98

    Joined:
    Mar 8, 2021
    Posts:
    43
    This is so exciting!

    Can I build for the play store out of the box, without exporting a gradle project and hacking around? I was in the process of trying to get it to work for 0.17.
     
  43. DreamingImLatios

    DreamingImLatios

    Joined:
    Jun 3, 2017
    Posts:
    4,264
    I'm using .Run() on the job, so it runs on the main thread. But besides that, I'm not really sure why it works. But it works with safety checks and all. Code for it is here, and you can compare it to the previous commit to see what it was like using EET prior to Entities 0.50. https://github.com/Dreaming381/Lati...ernal/InstantiateCommandBufferUntyped.cs#L248
     
    CookieStealer2 likes this.
  44. nikk98

    nikk98

    Joined:
    Mar 8, 2021
    Posts:
    43
    I'm trying to upgrade my project from 0.17 to 0.50, but platforms build packages do not seem aligned:
    - com.unity.platforms@0.50
    - com.unity.platforms.android@0.10.0

    They seem incompatible, I get the following compile error:

    Library/PackageCache/com.unity.platforms.android@0.10.0-preview.10/Editor/Unity.Build.Android/Components/AndroidKeystore.cs(12,25): error CS1929: 'HierarchicalComponentContainer<BuildConfiguration, IBuildComponent>.ReadOnly' does not contain a definition for 'GetBuildTargetGroup' and the best extension method overload 'BuildTargetExtensions.GetBuildTargetGroup(Platform)' requires a receiver of type 'Platform'


    Maybe the android platforms package was missed in the release?
     
  45. nikk98

    nikk98

    Joined:
    Mar 8, 2021
    Posts:
    43
  46. CookieStealer2

    CookieStealer2

    Joined:
    Jun 25, 2018
    Posts:
    119
    I'm also using Run(), but I've realized that it might be because I'm using ComponentTypeHandles in my job. I think that when Instantiate is called it will invalidate the handles and perform some kind of safety cleanup that's causing the exception. It makes sense I guess, but now I wonder how EET could perform structural changes without invalidating handles.
     
  47. EirikWahl

    EirikWahl

    Joined:
    Apr 7, 2018
    Posts:
    21
    Now that Unity 2021.3.0f1 is out, when can we expect Entities 0.51? (If you can not give an exact date, can you say if it will be days, weeks or months?)
     
    LudiKha, DrBoum, DevViktoria and 6 others like this.
  48. ChanceNCounter

    ChanceNCounter

    Joined:
    Dec 9, 2014
    Posts:
    23
    The original announcement gave a Q2 target. That's sometime by the end of June. It's mid-April. That's a pretty narrow estimate already.
     
    EirikWahl likes this.
  49. nikk98

    nikk98

    Joined:
    Mar 8, 2021
    Posts:
    43
    Now that ENABLE_HYBRID_RENDERER_V2 is gone, is it possible to add a DISABLE_HYBRID_RENDERER_V2?



    I did an analysis on firebase lab devices and the performance of the hybrid renderer is abysmal in most of them, presumably because of poor Vulkan support. The rendering was faster with the URP/Hybrid renderer in only 3 devices out of the 50+ (I'll publish the analysis at some point). I switched to URP/Hybrid renderer but I still can't push a release because of performance.

    No need to force the hybrid renderer since it's clearly not ready. It's ok to have a game object in the scene for rendering until OpenGL support is ready.
     
  50. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    883
    So I've upgraded my game from 0.17 to 0.50
    Most of the issues were due to codegen bugs and described by threads:

    https://forum.unity.com/threads/ent...nt-respect-in-withentityqueryoptions.1271876/
    https://forum.unity.com/threads/compilation-of-issues-with-0-50.1253973/
    https://forum.unity.com/threads/ent...ustom-top-level-componentsystemgroup.1271861/
    https://forum.unity.com/threads/issues-after-update-to-0-50.1270577/

    Also compilation time significantly increased and Visual Studio become much slower. Andyou can't inspect DOTS methods via CTRL+left click in Visual Studio anymore for some reason.
    Other than that no showstoppers so far.
     
Thread Status:
Not open for further replies.