Adding new Instanced Static Meshes to Blueprints.

Hi Everyone, I’ve made a BP that generates a wall using an instanced static mesh. I’ll attach and screen-cap of the viewport and my BP code for better understanding.




The problem that I’m facing is how do I add multiple meshes so my BP code can randomly use multiple meshes and create a wall(I’m just using instance of a single static mesh for now). Thanks in advance for the help!

You need to change your code to add all the instances first, and store them in an array.

Then, basically go into the same code, but where you have ‘add instance’, choose one of the instances from the array.

Hi ClockworkOcean, thanks for the reply. I’m new to UE blueprints so I don’t know if the BP code I’ve updated is correct or not. I’m attaching a screen-cap of the updated BP code for reference. Since I can’t attach another screen-cap. I’ve plugged in the return value of “Add Instanced Static Mesh Component” to the Target Value of “Add Instance”. Thanks again for the help!

Not quite.

If you want 5 different shapes, you need five of these nodes

image

You add instances later. Here’s a ( very ) rough overview

I don’t want different shapes but different meshes, So is it fine if I follow the code in the your second screen-cap?

1 Like

That’s what I mean by different shapes…

Do you mean something like this?

Nope, exactly what I have in my pic there… :slight_smile:

The only thing my code doesn’t do is set the instance transform. Everything else is there.

Am I on the right path?
Also just a quick question, any reasons why I am getting this error?
This blueprint (self) is not a StaticMeshComponent, therefore ’ Target ’ must have a connection.

Corrected pic uploaded ( above ).

Thanks for that but any idea on the error that I’m getting

Take a look at the pic, it has another line connected there.

image

Thanks a lot, it works perfectly! Can’t thank you enough for your help :slight_smile: Cheers!

1 Like

Posting the BP code link incase someone wants a reference

1 Like