docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method WithDisabledRW

    WithDisabledRW<T1>()

    Add required disabled component types to the query with ReadWrite mode.

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

    The builder object that invoked this method.

    Type Parameters
    Name Description
    T1

    A required disabled ReadWrite component type

    Remarks

    If a query uses the FilterWriteGroup option, you must use WithDisabledRW to specify the query's writeable required components. Refer to the write groups guide for more information.

    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.

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

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

    To request read-only access, use WithDisabled<T>(ref T)

    WithDisabledRW<T1, T2>()

    Add required disabled component types to the query with ReadWrite mode.

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

    The builder object that invoked this method.

    Type Parameters
    Name Description
    T1

    A required disabled ReadWrite component type

    T2

    A required disabled ReadWrite component type

    Remarks

    If a query uses the FilterWriteGroup option, you must use WithDisabledRW to specify the query's writeable required components. Refer to the write groups guide for more information.

    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.

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

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

    To request read-only access, use WithDisabled<T>(ref T)

    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)