Skip to content

Tag support in QuerySystem generic parameters? #7

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

You must be logged in to vote

To filter the result set of a QuerySystem<> with tags you can use its Filter property. E.g.

struct Pulsating : ITag { }

class PulseSystem : QuerySystem<Scale3>
{   
    public PulseSystem() => Filter.AnyTags(Tags.Get<Pulsating>());
    
    protected override void OnUpdate() {
        // ...
    }
}

In case you want to create a custom system by extending BaseSystem you can access the stores with SystemRoot.Stores. E.g.

class CustomSystem : BaseSystem
{   
    protected override void OnUpdate() {
        foreach (var store in SystemRoot.Stores) {
            // iterate all entities in a store
            foreach (var entity in store.Entities) { }
        }
    }
}

You are right. A QuerySy…

Replies: 1 comment 1 reply

Comment options

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

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