docs.unity.cn
    Show / Hide Table of Contents

    Method WithAllRW

    WithAllRW<T1>()

    Add required component types to the query with ReadWrite mode.

    Declaration
    [GenerateTestsForBurstCompatibility(GenericTypeArguments = new Type[]{typeof(BurstCompatibleComponentData)})]
    public EntityQueryBuilder WithAllRW<T1>()
    Returns
    Type Description
    EntityQueryBuilder

    The builder object that invoked this method.

    Type Parameters
    Name Description
    T1

    A required ReadWrite component type

    Remarks

    If a query uses the FilterWriteGroup option, you must use WithAllRW 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.

    WithAllRW 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 to the reference component(s), use WithAll<T>(ref T)

    WithAllRW<T1, T2>()

    Add required component types to the query with ReadWrite mode.

    Declaration
    [GenerateTestsForBurstCompatibility(GenericTypeArguments = new Type[]{typeof(BurstCompatibleComponentData), typeof(BurstCompatibleComponentData)})]
    public EntityQueryBuilder WithAllRW<T1, T2>()
    Returns
    Type Description
    EntityQueryBuilder

    The builder object that invoked this method.

    Type Parameters
    Name Description
    T1
    T2

    A required ReadWrite component type

    Remarks

    If a query uses the FilterWriteGroup option, you must use WithAllRW 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.

    WithAllRW 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 to the reference component(s), use WithAll<T>(ref T)

    Back to top Copyright © 2023 Unity Technologies — Terms of use
    Generated by DocFX
    on Wednesday, June 21, 2023