Proper Use of in Editor Function Calls for Instanced Static Meshes

Hello, I have the following simple test blueprint that has a function that is both run by the construction script, and callable in editor:


I call clear instances before I do the loop to build the instanced mesh, as I want it so that with each instance of the blueprint, or update of the blueprint randomizing the XY location between 0-50cm:

However, as seen in the next image below, it does not remove the instanced meshes, and just keeps making more:

That being said, if I now doing anything to that blueprint; move, rotate, etc. it will return to just one random translated instance.

Not sure what I’m doing wrong, but I’m basically just looking to have the function act like a recall to the construction script, so I could have an editor utility run through a loop of all copies of this blueprint in the editor, and give each copy a new random XY location.

Any help would be greatly appreciated.

Hi,

You’re create a new InstancedStaticMesh Component each time - rather than do that, add one of those components to your actor and use that.

image

Ok, yes. This works now. Thanks you!

1 Like