Friflo.Engine.ECS icon indicating copy to clipboard operation
Friflo.Engine.ECS copied to clipboard

SystemGroup (SystemRoot) only calls the first function added to it.

Open Isolyth opened this issue 11 months ago • 1 comments

public override void _Ready()
	{
		EntityManager.Initialize();
		root = new(EntityManager.Store){
			new SpriteRenderingSystem(),
			new SpriteRIDAdder()
		};
		var store = EntityManager.Store;
		store.CreateEntity();
		store.CreateEntity();
		var sprite = store.CreateEntity();
		sprite.AddComponent(new RCPosition{Position = new(0,256)});
		sprite.AddComponent(new RCRotation{Angle = 14});
		sprite.AddComponent(new RCSprite{Texture = ResourceLoader.Load<Texture2D>("res://icon.svg"), Dirty = true});
		sprite.AddComponent(new RCSpriteRID());
		
	}

	// Called every frame. 'delta' is the elapsed time since the previous frame.
	public override void _Process(double delta)
	{
		acc += delta;

		if (acc >= 0.5){
			root.Update(default);
			acc = 0;
		}
	}

Only the first system gets called, I have tested with swapping the location of both systems, and in both cases only the first system will be the called, the second will not.

Isolyth avatar Jan 01 '25 07:01 Isolyth

Can you add a perf log after instantiation and Update() to see the system hierarchy? Maybe the second system is disabled or an exception is thrown by the first system.

    GD.Print(root.GetPerfLog());

The setup of systems is a very basic operation.
In issue like this should have already been reported and seen in unit tests.

friflo avatar Jan 01 '25 07:01 friflo