docs.unity.cn
    Show / Hide Table of Contents

    Method AddAdditionalQuery

    AddAdditionalQuery()

    Add an additional query description to a single EntityQuery.

    Declaration
    public EntityQueryBuilder AddAdditionalQuery()
    Returns
    Type Description
    EntityQueryBuilder

    Returns the amended EntityQuery.

    Remarks

    The resulting EntityQuery will match all entities matched by any individual query description. In terms of set theory, the query matches the union of its query descriptions, not the intersection.

                EntityQuery query = new EntityQueryBuilder(Allocator.Temp)
                    .WithAll<Parent>().WithNone<Child>()
                    .AddAdditionalQuery()
                    .WithAll<Child>().WithNone<Parent>()
                    .Build(this);

    The EntityQuery created from this builder matches entities that have a Parent component but no Child component OR have a Child component but no Parent component.

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