- Home /
EntityQuery a specific Archetype
EntityQuery queries all entities that have the components described in the query. What i'd like to query is all the entities of a certain archetype. So entities that have ONLY the components i pass as parameter.
Is there functionality that either queries an archetype or queries in an "Only" manner. I could not find a function that did this. And the EntityQueryDesc only has "Any", "All" and "None".
(One workaround i thought of is adding an empty component per unique combination, but this seems convoluted while this functionality should be easily implemented by Unity)
Answer by gnostici · Apr 07, 2020 at 01:51 PM
Have the archetype contain its own entity type, and then be sure to never use entities as components.
public class ExampleEntity : MonoBehavior
{
private EntityManager eMan;
public EntityArchetype eArch;
void Start ()
{
eArch = eMan.CreateArchetype
(
typeof(ExampleEntity)
// ...
)
// ...
}
}
(in some system somewhere...)
EntityQuery eQuer = GetEntityQuery(typeof(ExampleEntity));
Your answer
Follow this Question
Related Questions
Firebase query based on Timestamp 1 Answer
How to convert a curl query to wwwform 2 Answers
Linq Query - Strange Outcome 1 Answer
Query Related to Virtual Keyboard 0 Answers
Delay in approval 1 Answer