Interchanging skeletal meshes using the random integer function
In this section, we will configure the logic inside the Character Blueprint so that it will randomly swap skeletal mesh characters. This will introduce diversity to the spawned actors within the PCG graph once they are generated, allowing the crowd to represent different characters with randomly selected animations.
Now, let’s dive into the step-by-step guide:
- Select and drag out two arrays from the VARIABLES section: SkeletalMesh and AnimSequence. Make sure to set them as Get variables and add them to the Event Graph.
Figure 9.16 – Drag and drop the Skeletal Mesh and Anim Sequence arrays onto the Event Graph
- The next step is to add two functions for each array variable to your event graph, and they are Set Skeletal Mesh Asset and Play Animation. As you may have noticed, the functions will already be assigned to the Mesh component, which helps to save you...