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
}