Skip to content

Multiple queries in one system #19

Answered by friflo
Danon5 asked this question in Q&A
Discussion options

You must be logged in to vote

Late answer caused by focus of final release v3.0.0 - sorry.
But anyway.

I added an example to the documentation which enables execution of nested queries.
See: https://friflo.gitbook.io/friflo.engine.ecs/documentation/systems#custom-system

So for the given code snippet it would kook like:

public sealed class SomeSystem : QuerySystem<SomeComponent> {
    private ArchetypeQuery<Position> m_someQuery;   
    
    protected override void OnAddStore(EntityStore store) {
        m_someQuery = store.Query<Position>();
        base.OnAddStore(store); // must be called to ensure execution of OnUpdate()
    }
    
    /// Executes m_someQuery and the base class Query in nested loops.
    protected o…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@friflo
Comment options

Answer selected by friflo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants