Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Isolyth opened this issue Jan 1, 2025 · 1 comment
Open

Comments

@Isolyth
Copy link

Isolyth commented Jan 1, 2025

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.

@friflo
Copy link
Owner

friflo commented Jan 1, 2025

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants