Query
Small example for getting all Vehicle
Components that doesn't have the Deleted
or Temp
Components (all active vehicles) inside a GameSystemBase
which your System should extend from:
this.m_VehicleQuery = this.GetEntityQuery(new EntityQueryDesc() {
All = new ComponentType[1] {
ComponentType.ReadOnly<Vehicle>()
},
None = new ComponentType[2] {
ComponentType.ReadOnly<Deleted>(),
ComponentType.ReadOnly<Temp>()
}
});
Then you can do things like count the number of found Entities with that matching set:
var count = this.m_VehicleQuery.CalculateEntityCount();