Create Row of Static Meshes in Construction Script

Hi everyone,

I’m trying to create a row of pikes dynamically.
The main idea is to place the Blueprint on the level, and choose the number of spikes it will generate to make the row.
Basically, I tried making a for loop with a variable as a last index, and use the “Add Static Mesh Component” to create the spikes.
Here’s what I got so far:

Could guys point me where did I do wrong?
I’m quite new to UE and game development, and I’m trying to use the Construction Script in the Blueprint to do this.

What you have so far, should be working, you just cannot see anything, because the “Add Static Mesh Component” has not “static mesh” assigned to it, that can be drawn.

You will want to create a new variable, that is of a type “Static Mesh Reference” and set that to be “editable” so you can see it in the editor, and drag and drop a static mesh to it. Then use the variable as input to the node of “Set Static Mesh”, with the component that you have already created as the “target”.

So…

  1. Create the variable, for the Static Mesh Reference
  2. Create the blueprint node of “Set Static Mesh”
  3. wire it in after the Add Static Mesh Component. Either before the “Set Relative location…” node, or after it. It will not make a difference.

That should get you up and running.

Hope this helps,

@jayice, Im sorry, I didnt get your answer at first. After seeing some other threads, I got the same response - but with a print screen, and I could see (realize) your answer was right! Sorry…

Thank you very much!

Here`s how I did it:

yep, your answer-1.png will do it, you have the “set mesh” node in there, so you are good to go. Glad to see it worked for you!