Skip to content

Is it possible to dynamically create query descriptions based on a list of types? #89

Answered by genaray
proc-gen asked this question in Q&A
Discussion options

You must be logged in to vote

Sooo i found the issue. Its not a bug, it was an logic mistake ^^

First of all, your spellQueries are... empty. No all, any or none set. I assume that your code to fill the doesn't work properly.
Thus each SpellQuery targets ALL entities.

Second, the world.Query trys to access ref Position position. Since the query targets ALL entities, it tries to receive the position from ALL of them (also entities without it) which throws that exception.

Use this instead for your spellQueries :

                var spellQuery = new QueryDescription
                {
                    All = new[] { Component.GetComponentType(spellType), typeof(Position) }
                };

So make sure the spellQuerie…

Replies: 3 comments 4 replies

Comment options

You must be logged in to vote
1 reply
@proc-gen
Comment options

Comment options

You must be logged in to vote
2 replies
@proc-gen
Comment options

@genaray
Comment options

Comment options

You must be logged in to vote
1 reply
@proc-gen
Comment options

Answer selected by proc-gen
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