Skip to main content

Spawn Conditions

Each component, PathTemplate, or PathTemplateGroup can be configured to spawn conditionally - based on whether a specific PathLabel is fulfilled within a defined DetectionRange. For instance, a guardrail mesh might spawn only if there is a cliff on the right side of the road, or a "Tunnel" PathTemplate might spawn only when the path goes underground.

Component Spawn Condition

To configure the SpawnCondition for a component, open the PathTemplate. Select the Blueprint name at the top of the component list and expand the list of Spawn Conditions on the right side.

PathTemplate and PathTemplateGroup Spawn Condition

The SpawnConditions for PathTemplates or PathTemplateGroups are set in the PathDescription. PathTemplateGroups can include other Groups or individual PathTemplates. A PathTemplate will spawn only if both its own SpawnCondition and the SpawnConditions of all its parent Groups are fulfilled.

Detection Range

Component configured to spawn conditionally is spawned only if the Label assigned to it is fulfilled within the Detection Range. Detection Range can be configured to match the bounds of the component, or can be scaled and offset relative to component/PathTemplate bounds.

Detection Range is visualized in the PathTemplate when you hover the cursor over the spawn condition.

image

Detection Range is also visualized in the level editor for the selected component, when in the Labels tool and debug mode is enabled.

image

To toggle whether the DetectionRange is relative to the component or the PathTemplate, click the top bar in the SpawnCondition settings. This option is only applicable to components and is not available for PathTemplates in the PathDescription.

Detection modes

By default, a component will be spawned if the Label is fulfilled anywhere within the Detection Range. It can also be set to spawn only at the start or end of the Label or when the Label is fulfilled everywhere within the Detection Range. To cycle between those modes click the bar representing the Label. The tooltip explains the meaning of the currently selected mode.

Examples:

  • "TunnelEntry" mesh should spawn only where the "Underground" Label starts. In other words, when the "Underground" Label's start is within the Detection Range.
  • "TunnelExit" should spawn only when the Label "Underground" ends. In other words, when the "Underground" Label's end is within the Detection Range.
  • "TunnelMiddle" should spawn only if the "Underground" Label covers the entire length of the "TunnelMiddle" mesh. In other words, when the "Underground" Label is fulfilled everywhere within the Detection Range (and the Detection Range is configured to match the "TunnelMiddle" mesh length and location).

Here is an example of a barrier spawned at the start or end of the sharp turn:

Spawn with Offset

It's also possible to offset the Detection Range forward/backwards along the Path. This means the component can be spawned with a certain offset from a given Label. You could for example spawn a road sign that warns about a sharp turn and is placed 100 meters ahead of the turn.

Negated Spawn Condition

Spawn Condition can also be negated, meaning the component will spawn only if the condition is not fulfilled. Negated conditions have a gray-striped background for better visibility.

Spawn Conditions for Secondary PathSplines

PathTemplates with multiple PathSplines (such as intersections) can define SpawnConditions based on PathLabels from secondary PathSplines. For example, in Y-shaped intersection, certain components can spawn conditionally based on Labels from the first branch, while others depend on Labels from the second branch.