Skip to content

Add Query Unique #60

Open
Open
@Difficulty-in-naming

Description

@Difficulty-in-naming

We need a method to query singleton components. We will use this method in many scenarios, such as Player Input, making the code look more concise and readable.

    private QueryDescription mDescription = new QueryDescription{Any = new ComponentType[]{typeof(C_PlayerInput)}};
    public void Query()
    {
        world.Query(mDescription, (ref C_PlayerInput input) =>
        {
            if (input.IsClicked)
            {
                //Query another entity....
            }
        });
    }
    public void QueryUnique()
    {
        var playerInput = world.QueryUnique<C_PlayerInput>();
        //Query another entity...
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions