Manually created System does not update

Hi,
I have similar problem as our frind two years ago Manually created System does not update
I have system that work fine when its created in default way. But when I add DisableAutoCreation attribute and use World.CreateSystem - this system added to World.AllSystems list, but not added to any SystemGroup, even not in Simulation group. That’s probably why its not updated.
Fearing some complex hidden mistakes i create new test system which also work fine without DisableAutoCreation attribute.

namespace Core.Systems.Simulation.Battle
{
    [DisableAutoCreation]
    public partial class TestSystem : SystemBase
    {
        protected override void OnCreate()
        {
            RequireSingletonForUpdate<BattleData>();
            Debug.LogError("I am created");
        }

        protected override void OnUpdate()
        {
            Debug.LogError("I am alive");
        }
    }
}

And when I add DisableAutoCreation and create this system through World.CreateSystem, this sistem also added to World.AllSystems list, but not added to any SystemGroup. And also not updated.

I also try using World.AddSystem, World.GetOrCreateSystem with expected same result.

P.S. I need to create system by myself to be able to add readonly static struct to my system. This struct is map data so its immuatable. So I won’t to add local variable and copy all this big data on each frame.
Do you know the best way to solve this problem?

 protected override void OnUpdate()
{
        var mapData = this.mapData;
        // using map data in job
}
1 Like

You could get one of the existing system groups (whichever specific one you’re using) and call
group.AddSystemToUpdateList(yourSystem).

3 Likes

Thanks this resolve my problem.
Very strange that i don’t find mentions about requirness of this call in docs at least in chapter Worlds - Managing systems.
Expected behaviour - i already described system group by attribute in system, so when I am creating system it whould be added to described system group byself (by World.CreateSystem)

1 Like

I feel that the systems with [DisableAutoCreation] should not be Auto-created, but should be Auto-updated upon creation, especially when [AlwaysUpdateSystem] is deprecated.

By the way, I start the system with [DisableAutoCreation] in ISystem with command World.DefaultGameObjectInjectionWorld.GetExistingSystemManaged<SimulationSystemGroup>().AddSystemToUpdateList(World.DefaultGameObjectInjectionWorld.CreateSystem<YourDisableAutoCreationSystemName>());
That way the system is created and updates in SimulationSystemGroup.