Method WithAllChunkComponent
WithAllChunkComponent<T>()
Add a required Chunk Component type to the query.
Declaration
public EntityQueryBuilder WithAllChunkComponent<T>()
Returns
Type | Description |
---|---|
EntityQueryBuilder | The builder object that invoked this method. |
Type Parameters
Name | Description |
---|---|
T | Component type to use as a required, read-only Chunk Component |
Remarks
Call this method on the query builder to find entities that have all the specified chunk components. Chunk components are a distinct component type, which are different from adding the same type as a standard component.
var entityWithPlayerComponent = EntityManager.CreateEntity();
EntityManager.AddComponent<Player>(entityWithPlayerComponent);
var entityWithPlayerChunkComponent = EntityManager.CreateEntity();
EntityManager.AddComponent(entityWithPlayerChunkComponent, ComponentType.ChunkComponent<Player>());
// This query will only match entityWithPlayerComponent
var playerQuery = new EntityQueryBuilder(Allocator.Temp)
.WithAll<Player>()
.Build(this);
// This query will only match entityWithPlayerChunkComponent
var chunkPlayerQuery = new EntityQueryBuilder(Allocator.Temp)
.WithAllChunkComponent<Player>()
.Build(this);
To add additional required Chunk Components, call this method multiple times.
The query will request read-only access to the referenced component(s). To request read/write access, use Unity.Entities.EntityQueryBuilder.WithAllChunkComponentRW``1(``0@)
To add component types that are not known at compile time, use WithAll<T>(ref T)