Procedural generation with the Construction Script
Procedural generation is a method of creating level content using scripts instead of manually. It can be used to avoid repetitive tasks in level editing. Our main tool to make procedural generation in Blueprints is the Construction Script.
We saw how to use the Construction Script in Chapter 3, Object-Oriented Programming and the Gameplay Framework, to allow a Level Designer to change the Static Mesh of a Blueprint in the Level Editor.
A useful component for procedural generation is the Instanced Static Mesh component. This component is optimized to render multiple copies of the same mesh in the level.
Note
There is also the Hierarchical Instanced Static Mesh component, which is similar to Instanced Static Mesh but is useful when the mesh has a Level of Detail (LOD).
We set the Static Mesh in the component and use the Add Instance function to add an instance on the level using Instance Transform: