rdInst Tutorial 5 – Converting Components to ISMs

Last Updated: 20th December 2022

A Handy way of adding and collating Instances is by adding “HiddenInGame” Static Mesh Components and then enumerating through them, adding them to the Managed ISM list. They show while editing, so you always see them in your level (plus you can click on them – which is more handy than instances which aren’t clickable). but hide when playing (after added them as instances).

Step 1. Create the Components

The first thing to do is to create the Static Mesh Components you’re wanting. Arrange them in Hierarchies too if you’re wanting to hide/show or randomize them.

  1. Create a Blueprint SubClassed from rdActor.
  2. Add a SceneComponent attached to the DefaultSceneRoot
  3. Name it “Folder1”
  4. Add a StaticMesh Component attached to Folder1. Set its StaticMesh, and set it to HiddenInGame.
  5. Add another SceneComponent attached to the DefaultSceneRoot
  6. Name it “Folder2”
  7. Add a StaticMesh Component attached to Folder2. Set its StaticMesh, and set it to HiddenInGame

Your Blueprint should now look like:

Step 2. Change the Actor Mode to “OnlyOne”

In the Details panel, find the property “Actor Mode” and change it to OnlyOne:

Step 3. Edit the BeginPlay Event

And now just go to the BeginPlay event, and make it look like this:

Step 4. Randomize every second

Seeing as the randomization system is keyed to using Seeds, every time you run the Blueprint, you will get the same actor showing. You can move the Setup code to the ConstructionScript – but then you will have a double up of Instances and your StaticMesh Components. rdBPtools keeps this side very simple – it will always just be instances (which is faster anyway).

Normally, your Blueprints like this one will be nested into other Blueprints (eg a Room Blueprint will have a Picture Blueprint showing random pictures). When your Blueprint has a parent rdInst Blueprint – it uses that Blueprints Seed rather than it’s own (unless you over-ride it). That way you can always get the same patterns – but over all nested Blueprints.

But to see our randomization working, just add this code to the Blueprints Tick event (make sure your tick is on and set the duration to 1sec or more)

Step 5. Done

That’s it – now we have a Blueprint that while editing shows the StaticMeshComponents (all of them unless you change the visibility), but while playing shows only one randomly selected folder of meshes as Instanced StaticMeshes.

Every second this will be re-randomized and you’ll see a different mesh.