Spawning new enemies in the Level Blueprint

In the Level Blueprint, turn your attention to the Event Graph. We want to initiate the spawning logic as soon as the game is played, and do so in a loop after every few seconds at a rate determined by the Spawn Time variable. Add an Event BeginPlay node to the Event Graph, and attach it to a Set Timer by Function Name node. Drag the SpawnTime variable onto the Time input pin, and check the box next to the Looping input pin. Finally, type Spawn inside the Function Name input field. We will create a custom Spawn Function that will be called on each pass through this loop. Remember to create a comment around these nodes as a reminder of the Function of this loop:

Now, add a Custom Event node to empty ...

Get Blueprints Visual Scripting for Unreal Engine - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.