docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method WithDisabled

    WithDisabled<T1>()

    Add required disabled component types to the query.

    Declaration
    public EntityQueryBuilder WithDisabled<T1>()
    Returns
    Type Description
    EntityQueryBuilder

    The builder object that invoked this method.

    Type Parameters
    Name Description
    T1

    A required disabled component type

    Remarks

    To match the resulting query, an Entity must have all of the query's required component types, and they must all be disabled. To require components to be enabled on matching entities, use WithAll<T1>(). To require components regardless of whether they are enabled on matching entities, use WithPresent<T1>().

    There are several ways to exclude components from a query:

    • WithAbsent<T>() matches all entities in chunks that do not have T at all.
    • WithDisabled<T>() matches chunks that must have T, but only matches entities where T is disabled.
    • WithNone<T>() matches both of the above cases: either the component isn't present at all, or it is present but disabled.

    WithDisabled accepts up to seven type arguments. You can add more component types by chaining calls together.

    var query = new EntityQueryBuilder(Allocator.Temp)
        .WithAll<ObjectPosition, ObjectVelocity>()
        .WithAll<ObjectRotation, ObjectRotationSpeed>()
        .Build(this);

    To add component types that are not known at compile time, use WithDisabled<T>(ref T)

    The query will request read-only access to the referenced component(s). To request read/write access, use Unity.Entities.EntityQueryBuilder.WithDisabledRW``1(``0@)

    WithDisabled<T1, T2>()

    Add required disabled component types to the query.

    Declaration
    public EntityQueryBuilder WithDisabled<T1, T2>()
    Returns
    Type Description
    EntityQueryBuilder

    The builder object that invoked this method.

    Type Parameters
    Name Description
    T1

    A required disabled component type

    T2

    A required disabled component type

    Remarks

    To match the resulting query, an Entity must have all of the query's required component types, and they must all be disabled. To require components to be enabled on matching entities, use WithAll<T1>(). To require components regardless of whether they are enabled on matching entities, use WithPresent<T1>().

    There are several ways to exclude components from a query:

    • WithAbsent<T>() matches all entities in chunks that do not have T at all.
    • WithDisabled<T>() matches chunks that must have T, but only matches entities where T is disabled.
    • WithNone<T>() matches both of the above cases: either the component isn't present at all, or it is present but disabled.

    WithDisabled accepts up to seven type arguments. You can add more component types by chaining calls together.

    var query = new EntityQueryBuilder(Allocator.Temp)
    .WithAll<ObjectPosition, ObjectVelocity>()
    .WithAll<ObjectRotation, ObjectRotationSpeed>()
    .Build(this);

    To add component types that are not known at compile time, use WithDisabled<T>(ref T)

    The query will request read-only access to the referenced component(s). To request read/write access, use Unity.Entities.EntityQueryBuilder.WithDisabledRW``1(``0@)

    WithDisabled<T1, T2, T3>()

    Add required disabled component types to the query.

    Declaration
    public EntityQueryBuilder WithDisabled<T1, T2, T3>()
    Returns
    Type Description
    EntityQueryBuilder

    The builder object that invoked this method.

    Type Parameters
    Name Description
    T1

    A required disabled component type

    T2

    A required disabled component type

    T3

    A required disabled component type

    Remarks

    To match the resulting query, an Entity must have all of the query's required component types, and they must all be disabled. To require components to be enabled on matching entities, use WithAll<T1>(). To require components regardless of whether they are enabled on matching entities, use WithPresent<T1>().

    There are several ways to exclude components from a query:

    • WithAbsent<T>() matches all entities in chunks that do not have T at all.
    • WithDisabled<T>() matches chunks that must have T, but only matches entities where T is disabled.
    • WithNone<T>() matches both of the above cases: either the component isn't present at all, or it is present but disabled.

    WithDisabled accepts up to seven type arguments. You can add more component types by chaining calls together.

    var query = new EntityQueryBuilder(Allocator.Temp)
    .WithAll<ObjectPosition, ObjectVelocity>()
    .WithAll<ObjectRotation, ObjectRotationSpeed>()
    .Build(this);

    To add component types that are not known at compile time, use WithDisabled<T>(ref T)

    The query will request read-only access to the referenced component(s). To request read/write access, use Unity.Entities.EntityQueryBuilder.WithDisabledRW``1(``0@)

    WithDisabled<T1, T2, T3, T4>()

    Add required disabled component types to the query.

    Declaration
    public EntityQueryBuilder WithDisabled<T1, T2, T3, T4>()
    Returns
    Type Description
    EntityQueryBuilder

    The builder object that invoked this method.

    Type Parameters
    Name Description
    T1

    A required disabled component type

    T2

    A required disabled component type

    T3

    A required disabled component type

    T4

    A required disabled component type

    Remarks

    To match the resulting query, an Entity must have all of the query's required component types, and they must all be disabled. To require components to be enabled on matching entities, use WithAll<T1>(). To require components regardless of whether they are enabled on matching entities, use WithPresent<T1>().

    There are several ways to exclude components from a query:

    • WithAbsent<T>() matches all entities in chunks that do not have T at all.
    • WithDisabled<T>() matches chunks that must have T, but only matches entities where T is disabled.
    • WithNone<T>() matches both of the above cases: either the component isn't present at all, or it is present but disabled.

    WithDisabled accepts up to seven type arguments. You can add more component types by chaining calls together.

    var query = new EntityQueryBuilder(Allocator.Temp)
    .WithAll<ObjectPosition, ObjectVelocity>()
    .WithAll<ObjectRotation, ObjectRotationSpeed>()
    .Build(this);

    To add component types that are not known at compile time, use WithDisabled<T>(ref T)

    The query will request read-only access to the referenced component(s). To request read/write access, use Unity.Entities.EntityQueryBuilder.WithDisabledRW``1(``0@)

    WithDisabled<T1, T2, T3, T4, T5>()

    Add required disabled component types to the query.

    Declaration
    public EntityQueryBuilder WithDisabled<T1, T2, T3, T4, T5>()
    Returns
    Type Description
    EntityQueryBuilder

    The builder object that invoked this method.

    Type Parameters
    Name Description
    T1

    A required disabled component type

    T2

    A required disabled component type

    T3

    A required disabled component type

    T4

    A required disabled component type

    T5

    A required disabled component type

    Remarks

    To match the resulting query, an Entity must have all of the query's required component types, and they must all be disabled. To require components to be enabled on matching entities, use WithAll<T1>(). To require components regardless of whether they are enabled on matching entities, use WithPresent<T1>().

    There are several ways to exclude components from a query:

    • WithAbsent<T>() matches all entities in chunks that do not have T at all.
    • WithDisabled<T>() matches chunks that must have T, but only matches entities where T is disabled.
    • WithNone<T>() matches both of the above cases: either the component isn't present at all, or it is present but disabled.

    WithDisabled accepts up to seven type arguments. You can add more component types by chaining calls together.

    var query = new EntityQueryBuilder(Allocator.Temp)
    .WithAll<ObjectPosition, ObjectVelocity>()
    .WithAll<ObjectRotation, ObjectRotationSpeed>()
    .Build(this);

    To add component types that are not known at compile time, use WithDisabled<T>(ref T)

    The query will request read-only access to the referenced component(s). To request read/write access, use Unity.Entities.EntityQueryBuilder.WithDisabledRW``1(``0@)

    WithDisabled<T1, T2, T3, T4, T5, T6>()

    Add required component types to the query.

    Declaration
    public EntityQueryBuilder WithDisabled<T1, T2, T3, T4, T5, T6>()
    Returns
    Type Description
    EntityQueryBuilder

    The builder object that invoked this method.

    Type Parameters
    Name Description
    T1

    A required component type

    T2

    A required component type

    T3

    A required component type

    T4

    A required component type

    T5

    A required component type

    T6

    A required disabled component type

    Remarks

    To match the resulting query, an Entity must have all of the query's required component types, and any required types that implement IEnableableComponent must be enabled. To require components to be disabled on matching entities, use WithDisabled<T1>(). To require components regardless of whether they are enabled on matching entities, use WithPresent<T1>().

    WithAll accepts up to seven type arguments. You can add more component types by chaining calls together.

    var query = new EntityQueryBuilder(Allocator.Temp)
    .WithAll<ObjectPosition, ObjectVelocity>()
    .WithAll<ObjectRotation, ObjectRotationSpeed>()
    .Build(this);

    To add component types that are not known at compile time, use WithAll<T>(ref T)

    The query will request read-only access to the referenced component(s). To request read/write access, use Unity.Entities.EntityQueryBuilder.WithAllRW``1(``0@)

    WithDisabled<T1, T2, T3, T4, T5, T6, T7>()

    Add required component types to the query.

    Declaration
    public EntityQueryBuilder WithDisabled<T1, T2, T3, T4, T5, T6, T7>()
    Returns
    Type Description
    EntityQueryBuilder

    The builder object that invoked this method.

    Type Parameters
    Name Description
    T1

    A required component type

    T2

    A required component type

    T3

    A required component type

    T4

    A required component type

    T5

    A required component type

    T6

    A required disabled component type

    T7

    A required disabled component type

    Remarks

    To match the resulting query, an Entity must have all of the query's required component types, and any required types that implement IEnableableComponent must be enabled. To require components to be disabled on matching entities, use WithDisabled<T1>(). To require components regardless of whether they are enabled on matching entities, use WithPresent<T1>().

    WithAll accepts up to seven type arguments. You can add more component types by chaining calls together.

    var query = new EntityQueryBuilder(Allocator.Temp)
    .WithAll<ObjectPosition, ObjectVelocity>()
    .WithAll<ObjectRotation, ObjectRotationSpeed>()
    .Build(this);

    To add component types that are not known at compile time, use WithAll<T>(ref T)

    The query will request read-only access to the referenced component(s). To request read/write access, use Unity.Entities.EntityQueryBuilder.WithAllRW``1(``0@)

    WithDisabled<T>(ref T)

    Add a list of required disabled component types to the query.

    Declaration
    public EntityQueryBuilder WithDisabled<T>(ref T componentTypes) where T : INativeList<ComponentType>
    Parameters
    Type Name Description
    T componentTypes

    A list of component types that implements Unity.Collections.INativeList<T>. For example, Unity.Collections.NativeList<T> or Unity.Collections.FixedList64Bytes<T>

    Returns
    Type Description
    EntityQueryBuilder

    The builder object that invoked this method.

    Type Parameters
    Name Description
    T

    A container of component types

    Remarks

    To match the resulting query, an Entity must have all of the query's required component types, and they must all be disabled.

    There are several ways to exclude components from a query:

    • WithAbsent<T>() matches all entities in chunks that do not have T at all.
    • WithDisabled<T>() matches chunks that must have T, but only matches entities where T is disabled.
    • WithNone<T>() matches both of the above cases: either the component isn't present at all, or it is present but disabled.
    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)