docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method WithPresent

    WithPresent<T1>()

    Add required component types to the query, whether the type is enabled or not.

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

    The builder object that invoked this method.

    Type Parameters
    Name Description
    T1

    A required component type

    Remarks

    To match the resulting query, an Entity must have all of the query's required component types, whether they are enabled or not. To match required types only if they're enabled, use WithAll<T1>(). To match required types only if they're disabled, use WithDisabled<T1>().

    WithPresent 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 WithPresent<T>(ref T)

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

    WithPresent<T1, T2>()

    Add required component types to the query, whether the type is enabled or not.

    Declaration
    public EntityQueryBuilder WithPresent<T1, T2>()
    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

    Remarks

    To match the resulting query, an Entity must have all of the query's required component types, whether they are enabled or not. To match required types only if they're enabled, use WithAll<T1>(). To match required types only if they're disabled, use WithDisabled<T1>().

    WithPresent 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 WithPresent<T>(ref T)

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

    WithPresent<T1, T2, T3>()

    Add required component types to the query, whether the type is enabled or not.

    Declaration
    public EntityQueryBuilder WithPresent<T1, T2, T3>()
    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

    Remarks

    To match the resulting query, an Entity must have all of the query's required component types, whether they are enabled or not. To match required types only if they're enabled, use WithAll<T1>(). To match required types only if they're disabled, use WithDisabled<T1>().

    WithPresent 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 WithPresent<T>(ref T)

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

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

    Add required component types to the query, whether the type is enabled or not.

    Declaration
    public EntityQueryBuilder WithPresent<T1, T2, T3, T4>()
    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

    Remarks

    To match the resulting query, an Entity must have all of the query's required component types, whether they are enabled or not. To match required types only if they're enabled, use WithAll<T1>(). To match required types only if they're disabled, use WithDisabled<T1>().

    WithPresent 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 WithPresent<T>(ref T)

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

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

    Add required component types to the query, whether the type is enabled or not.

    Declaration
    public EntityQueryBuilder WithPresent<T1, T2, T3, T4, T5>()
    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

    Remarks

    To match the resulting query, an Entity must have all of the query's required component types, whether they are enabled or not. To match required types only if they're enabled, use WithAll<T1>(). To match required types only if they're disabled, use WithDisabled<T1>().

    WithPresent 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 WithPresent<T>(ref T)

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

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

    Add required component types to the query, whether the type is enabled or not.

    Declaration
    public EntityQueryBuilder WithPresent<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 component type

    Remarks

    To match the resulting query, an Entity must have all of the query's required component types, whether they are enabled or not. To match required types only if they're enabled, use WithAll<T1>(). To match required types only if they're disabled, use WithDisabled<T1>().

    WithPresent 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 WithPresent<T>(ref T)

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

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

    Add required component types to the query, whether the type is enabled or not.

    Declaration
    public EntityQueryBuilder WithPresent<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 component type

    T7

    A required component type

    Remarks

    To match the resulting query, an Entity must have all of the query's required component types, whether they are enabled or not. To match required types only if they're enabled, use WithAll<T1>(). To match required types only if they're disabled, use WithDisabled<T1>().

    WithPresent 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 WithPresent<T>(ref T)

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

    WithPresent<T>(ref T)

    Add a list of required component types to the query, whether they are enabled or disabled.

    Declaration
    public EntityQueryBuilder WithPresent<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, regardless of whether they are enabled or 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)