← Learn library

Unreal Engine & Blueprints

Spawn Randomization

Channel: CGI Nerd Unreal Engine ·

Written guide

Original CGI Nerd Unreal Engine video thumbnail
Spawn RandomizationCGI Nerd Unreal Engine · Video hosted on YouTube

Playing loads YouTube content. YouTube processes data after activation.

Watch on YouTube

If the player is blocked or unavailable, use Watch on YouTube.

Software: Unreal Engine

This lesson spawns one Actor at one of three predefined Target Points when the level begins. The example “Enemy” Blueprint contains only a sphere, making it a visible placeholder for the spawn operation rather than a completed enemy with behavior.

The graph lives in the Level Blueprint because it references specific Target Points placed in that level. The exact Unreal Engine release is unidentified. Unlike the random static-mesh lesson, this changes where an Actor instance is created rather than which mesh an existing component displays.

Create the spawnable class and place the candidate points

At 00:01–02:01, the instructor creates an Actor Blueprint named Enemy and adds a sphere. A directly placed copy is used to inspect it, then removed because the Level Blueprint will create the runtime instance.

Three Target Points are placed at distinct locations. They represent possible spawn transforms, not three instructions to spawn three enemies.

Open the Level Blueprint and use Begin Play as the execution event. This establishes a single spawn attempt at the beginning of a play session; there is no recurring timer or wave-spawning system in the source.

Select one Target Point from an array

During 02:01–05:03, Spawn Actor from Class is configured to use the Enemy class. References to the three placed Target Points are collected into a Make Array node.

A Get operation selects one array element using Random Integer in Range. For the demonstrated three-element array, the bounds are zero and two. Those are the valid zero-based positions of the three references.

The random integer identifies a position in the array, while the returned array element is the Target Point object needed by the next operation. Supplying the integer alone cannot provide the point’s transform.

If the number of candidate points changes, inspect the array and bounds together. The demonstrated graph uses a manually entered maximum; it does not automatically derive that maximum from the array length or handle an empty list.

Pass the selected point’s transform into the spawn

At 05:03–06:12, Get Actor Transform reads the chosen Target Point, and its result supplies Spawn Transform. This passes a transform from that point, rather than manually constructing only a location vector.

The earlier compile error occurs while the spawn graph is incomplete. Once the required transform path is connected, compilation succeeds. The instructor tests play more than once and observes the sphere spawning at different candidate locations.

Verify the execution and data paths separately: Begin Play must reach the spawn operation, the class must be Enemy, and the selected Target Point’s transform must reach Spawn Transform. A valid random index does not compensate for a missing class or an unconnected spawn transform.

Repeated sessions may choose the same point again. The narrator’s description of a different location each time should be understood as varied possible outcomes, not a no-repeat guarantee. The recording does not implement occupancy checks, collision-failure handling, weighting, or a rule excluding the previous point. Its finished result is a single randomly located placeholder spawn among the three configured choices.