EQS Node Reference: Contexts

Describes how Contexts are used within Tests and Generators in the EQS system.

Within the Environment Query System (EQS), Contexts provide a frame of reference for any Tests or Generators used. A Context can be as simple as the Querier (who is performing the Test) or more complex such as All Actors of a Type. A Generator, such as a Points: Grid, can use a Context that returns multiple locations or Actors. This will create a grid (of the defined size and density) at the location of each Context. In addition to Engine supplied Contexts, you can create custom Contexts in Blueprint with the EnvQueryContext_BlueprintBase class or through C++ code. 


Items are created by the Generator, and if using the EQS Testing Pawn, they are the spheres that appear in the Editor. An EnvQueryContext_Item is either a location (FVector) or an Actor (AActor).


The Querier is the Pawn that is currently possessed by an AI Controller and is executing the Behavior Tree that initiated the Environment Query. An example of where Querier as the Context could be used is if you want to search the environment around the AI character for an item they can use or find a place that provides cover from the player, or just to determine the current location of the AI performing the query.

In the Details panel for a Generator type, you can assign the Querier as a Context for the following properties:



Actors of Class

Search Center

Actors of Class

Current Location

Query Context

Current Location

Points: Circle

Circle Center

Circle Point

Points: Cone

Center Actor

Cone Point

Points: Donut


Donut Point

Points: Grid

Generate Around

Grid Point

Points: Pathing Grid

Generate Around

Pathing Grid Point


You can create a custom Context through Blueprint using the EnvQueryContext_BlueprintBase Class. This provides four functions that can be overridden, enabling you to add your custom Contexts for use within Tests in a query.

To use a custom Context:

  1. Create a new Blueprint of the EnvQueryContext_BlueprintBase class.
    Create a new Blueprint of the EnvQueryContext BlueprintBase class

  2. In EnvQueryContext_BlueprintBase, click Override and select the type of function you wish to use.
    Click Override and select the type of function you wish to use

Refer to the table below for a description of each function override:



Provide Single Location

This returns a single location (vector). How you generate that location is up to you. For example, the function below will return the trace hit location of a random Actor (one that is found in the DesiredObjectType array, such as Pawn, Vehicle) found within 1500 cm of the Querier:

Provide Single Actor

This returns a single Actor. You can obtain that Actor through any method you desire. In this example, the function will return Player 0's controlled Actor:

Provide Single Actor

Provide Locations Set

This returns an array of locations (vectors). How you generate these locations is up to you. In the example below, this function will trace from 16 evenly spaced locations on a circle with a radius of 1500 units, returning successful hits on the environment:

Provide Actors Set

This returns an array of Actors. You can use any desired method to obtain those Actors. In the example below, we use a Get All Actors of Class node to retrieve our specified class as the Actors to return:

Provide Actors Set

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey