Invoke Spawn Query

For custom behaviors after an entry is selected or spawned, you need to create custom types and invoke Spawn Query graphs from blueprints or C++ code.

Create Custom Row Types

All pool tables should use row types that are derived from FSpawnEntryTableRowBase. To create your own table format, you must create a class deriving from it in C++ and add necessary fields. Once you have the class, you can create the Data Table asset with it as the row type.

Invoke the Graph

To get an entry from a Spawn Query graph, use Query Entry function node in Blueprints. It will return a USpawnEntryBase object, which is the base class of all the entries.

If the context argument is not supplied, it will use the default context, which is globally unique throughout the application runtime. It is recommended to reset the context in your UGameInstance class.

To get the row data from USpawnEntryBase object, use Get Spawn Entry Row node and connect its output to the input in your row type. Normally it's Break <your type's name> node.

From here you can create your own logic taking the row data to spawn actors or assign properties.

Blackboard

Use the variables on the Blackboard in the context to control the SpawnQuery's behavior.

Use Set Blackboard Asset node to assign a Blackboard data to the context, after Get Default Spawn Query Context node.

When creating new contexts, pass a Blackboard data value to Construct Spawn Query Context node to assign it.

If your Spawn Query graph does not use Blackboard-related nodes, you don't have to set the Blackboard data of the context.

Manage Contexts

When you world is partitioned into different parts, each has its own states about spawning objects, or you are using Spawn Query graphs for different systems, you may need to create multiple contexts and manage them.

The recommended way is to create contexts with Construct Spawn Query Context node in your UGameInstance or in your subsystems.

The context contains the random seed, all the internal states of nodes and blackboard values. You can reset the context with a certain seed, which will clear all the states to the default.