Experimental Entities 0.50 is Available

Looks like you need to remove platform-specific Platforms packages and add com.unity.platforms instead.
https://docs.unity3d.com/Packages/com.unity.entities@0.50/manual/upgrade-guide.html#platforms

Could you provide an example of the incorrect behavior you’ve observed about GetComponent/SetComponent?
I couldn’t reproduce it on a simple test, I must be missing some context.

public partial class TestSystem : SystemBase
{
    private Entity targetEntity;
    private Entity sourceEntity;

    protected override void OnCreate()
    {
        targetEntity = EntityManager.CreateEntity(typeof(Translation));
        sourceEntity = EntityManager.CreateEntity(typeof(Translation));
    }

    protected override void OnUpdate()
    {
        SetComponent(sourceEntity, new Translation { Value = GlobalSystemVersion });
        SetComponent(targetEntity, GetComponent<Translation>(sourceEntity));
        Debug.Log(GetComponent<Translation>(targetEntity).Value);
    }
}

Probably inside ForEach? As in OnUpdate it’s EntityManager and inside ForEach it’s CDFE and codegen

1 Like

Ah yes, indeed! Thanks eizenhorn!

In a codegen context (like Entities.ForEach or Job.WithCode), having multiple calls in the same expression can trigger a compiler error. The workaround is to turn this:

SetComponent(targetEntity, GetComponent<Translation>(sourceEntity));

Into this:

var value =  GetComponent<Translation>(sourceEntity);
SetComponent(targetEntity, value);

We should add a note to the upgrade guide, thanks!

4 Likes

I’ve been compiling a list of a regressions I found today upgrading projects to 0.50

I still have more, just slowly adding to it.

4 Likes

this is very important for 2021 LTS users because many features on URP are compatible with 2021+ (like URP decals…)

@Fabrice_Lete Is that possible to improve this? Now become more typing seems not really nice.

This is a known issue and not an intentional change. It will get fixed but the only thing I can suggest for now is the workaround of splitting those expressions into multiple ones.

2 Likes

First, its great to see a new Entities release after so long. Regrettably, it includes a decision that, for us, effectively makes ECS unusable for now. The decision to only support Vulkan (and no longer OpenGL) with Hybrid Renderer V2 and to remove V1 means that ECS can effectively not be used together with ARFoundation when targeting Android as ARCore at this point does not support Vulkan (and it seems that there is not much willingness to support it: Feature Request: Support for Vulkan (VK_KHR_external_memory) · Issue #258 · google-ar/arcore-android-sdk · GitHub).

Are there any plausible workarounds which provide an upgrade path from older ECS versions when using ARFoundation?

The plan is to support GLES 3.1 and up with Entities 1.0. So if you need GLES support during development or before Entities 1.0 ships then your best option is to stay on 0.17 (And continue to use Hybrid Renderer V1) until we release Entities 1.0.

2 Likes

we are planning to release our game around 01/2023, we have created a custom hybrid renderer based on DrawMeshInstancedIndirect and compute shaders for frustum culling…
we already support GLES 3.1+ and Vukan, but we will have endless work to keep up with new ECS/URP features.
I don’t want to ask for the release date of Entities1.0 as I know it’s not that simple but could you advice us to keep developing our custom hybrid renderer or just focus on the game and wait the official hybrid renderer 1.0.

Thank you!

1 Like

We discovered this issue ourselves just a short while ago; sorry about that. Yes, using EET from worker threads is still intended to work; it just didn’t have sufficient internal code coverage to catch this issue. We’ll fix it in a patch release.

5 Likes

This is such an awesome thing to see. Especially with how long there wasn’t much news. :slight_smile: I can’t wait to get back into using DOTS again. I have found a massive love for DoD and ECS design systems, so thanks for all the hard work.

3 Likes

This was the issue and the workaround I implemented. It is not that big of a deal. But it caught me off guard and the error was not helpful.

Yeah. My use case is doing a series of instantiations and such in a Burst context using IJob.Run(). Turns out I can just pass in the EntityManager directly without having to go through EET. That used to not be allowed. So fortunately that was another easy workaround.

I did find a third issue and workaround. Entities.WithChangeFilter now forces a sync point on that component on the main thread. So I had to switch all instances of this to use IJobEntityBatch and use batchInChunk.DidChange

Right now my biggest issue is with Burst when safety checks are enabled. Burst throws an internal exception for some of the jobs in my project.

There’s a few transform bugs and regressions lingering. I’ll try to make proper bug reports for those in the near-ish future. But the big one that I called out in a previous thread is that change filtering in LocalToParentSystem is non-deterministic.

Also the Systems window is broken for me still. Though this time it might be my fault so I still need to investigate. EDIT: It is broken. Using ScriptBehaviourUpdateOrder.AppendSystemToPlayerLoop to add a system that isn’t one of the blessed root system groups causes the Systems window to just not show anything.

All in all, I got my little test game of 60-some odd systems running against the latest DOTS already. That’s a lot better than I expected! Even audio is working thanks to the DSPGraph patch release that no one is talking about!

1 Like

Ever since I heard that Entities was being re-written with source generators I’ve been anticipating this day!

I would love to know more about how Entities pulled it off and if there’s some way we can do source generators like this in 2020.3! I know it’s supported in 2021.2 but the workflow is far from ideal. I don’t suspect this will be easier, but would still be super interesting!

The package uses some obsolete methods from Collections, which is fine normally but breaks if you are using warnings-as-errors

That is great to hear.

Will Entities 0.17 work with 2021.3 LTS? And do you already have a ballpark target for when Entities 1.0 should be out?

Are there package installs for com.unity.platforms.XX? Specifically I want to test the Android ECS build and I can’t get subscenes to build without updates to those packages. I was using Entities 0.17 with Hybrid Renderer 0.11 and Android platforms 0.10 and it was working but I’d like to try Entities 0.50

These packages no longer exists. There is only a single com.unity.platform package now.

3 Likes

Am I the only one who gets the following error with no further explanation?

Microsoft (R) Visual C# Compiler version 3.8.0-dev.20527.1 (53dc6556)
Copyright (C) Microsoft Corporation. All rights reserved.
error SGJE0003: The parameter 'index' of type int will be ignored.

This is after fixing a lot of issues logged on the console such as nested ForEach and AddComponent(query). There is no way for us to understand what’s wrong / what to do to fix the problem.