rdInst Tutorial 3 – Adding Fast, Unmanaged Instances
Last Updated: 27th January 2023
Managed Instances have a lot of advantages – they are very easy to use, but because they are managed, there is a little overhead while editing, or showing/hiding during runtime.
If you don’t need those benefits, you can access the raw Instancing Components themselves, those are still managed, but the instances they return are not added to the managed tables.
Step 1. Create a Blueprint with Parent of rdActor
Right Click in your content browser and create a new Blueprint.
Select “rdActor” from the list of parents (I type it in the search box) then click “Select”
Give the new Blueprint a name, then open in the Blueprint Editor and change the ActorMode to “None”.
Step 2. Create a Function to Spawn the Instances
Create a new Function in your Blueprint called “SetupInstances” and make it look like this:
Note that if you’re landscape is not at zero, you’ll need to set the Z position in both those vectors to a value above the landscape.
Step 3. Edit the Blueprints ConstructionScript Function
Now open the “ConstructionScript” function in the Blueprint (double click) and create a blueprint that is the same as the image below.
The “rdIsRealWorld” is used here to find if we are getting called from the Blueprint Editor or Editor initialization, or from the actual level construction. We only ever want to create them in the Level.
Step 4. Edit the BeginPlay Event
Add a call to SetupInstances in the BeginPlay too – that ensures it gets created at play. If you don’t need to see them during editing, you can even remove the Setup from the Construction Script.
Step 5. Add to the scene
That’s all there is to it.
Now all you need is add the Blueprint to your scene and you’re done. Notice though, if you hadn’t added the “Clear Instances” and you moved the actor around in the level while editing, it would recreate the instances, but doesn’t remove the old ones, so you end up with a trail of instances, the down-side to un-managed instances.
Also, if you delete the actor, or change meshes etc, it won’t delete the old instances – you have to manually call the HISMC’s ClearInstances function to remove the Instances. Managed Instances (the ones the other Tutorials use) do remove the instances when you delete the actor etc.