#Did the latest version of DOTS ECS break the SystemBase added through AddSystemManaged?

1 messages · Page 1 of 1 (latest)

rigid flax
#

in hindsight is such a specialised case that I wouldn't be surprised if it's true

    public partial class RenderingDOTSPositionSyncEngine:SystemBase
{
}```

cannot be added anymore through AddSystemManaged because not registered inside TypeManager (GetSystemTypeIndex fails). I suppose because of the [DisableAutoCreation]
rigid flax
#

Did the latest version of DOTS ECS break the SystemBase added through AddSystemManaged?

uncut cape
#

I pasted the following into one of the Entities package test files, and the test passes.

[DisableAutoCreation]
public partial class RenderingDOTSPositionSyncEngine:SystemBase
{
    protected override void OnUpdate()
    {
        throw new InvalidOperationException("I ran!");
    }
}
[Test]
public void AddSystemManaged_WithDisableAutoCreation_Works()
{
    var sysInstance = new RenderingDOTSPositionSyncEngine();
    var sys = World.AddSystemManaged(sysInstance);
    Assert.That(() => sys.Update(), Throws.InvalidOperationException.With.Message.Contain("I ran!") );
}

Is there any further context that could be contributing to this error? What's the specific error you're seeing?

#

@spare nebula suggests adding this check to AddSystemManaged(), which would guard against the case where an unregistered system type is somehow provided. The same check is already present in CreateSystemManaged().

if (idx == SystemTypeIndex.Null)
{
    TypeManager.AddSystemTypeToTablesAfterInit(typeof(T));
    idx = TypeManager.GetSystemTypeIndex<T>();
}

...but we're still not sure why the system wouldn't be registered in the first place.

uncut cape
#

Anyway, we'll push the fix to the next Entities release. Thanks for the report!

rigid flax
#

@uncut cape just read this, thank you for fixing it

#

although I didn't get if you were able to repro it