Why are my simple construction scripts extremely laggy?

Hi, I created a very simple construction script for a fence (very similar to the one in your Content Examples), which adds really low poly fence-segments depending on the length of it. These fence segments are 4 tris each, and also have a very basic material with a base texture, and a normal map. The problem is that adding only a few of these fences (I made 5 fences at about 2000 segments each, so about 10.000 tris in total) drags the FPS down from 60-70 to a mere 15-20!

I tried adding these fence segments manually instead and, as I suspected, it doesn’t have a performance hit at all! Is this a bug with construction scripts or am I missing something major?

I’m not sure, but I suspect that it may have to do with the blueprint you set up not instancing the mesh’s but instead making a new version of each so there are a lot of draw calls happening. Can somebody comment on if I’m on the right track with that thought?

Yeah you definitely want to use instances if you are dropping that many meshes into the world.

If you need to be able to interact with and destroy the fence you would then want to add invisible volumes with each little instance so you can reference the volume instead of the rendered mesh.

That fixed it, thank you! However, it doesn’t seem to be movable? I added an InstanceStaticMeshComponent in the compnents-section in the blueprint, and attached it to my collisionbox (which has physics), but it just stands in the spawn transform whilst the collisionbox tumbles around?

Nevermind, I found that if you change the ISMC to from Movable to Static it works! :wink:

Please accept his answer if it worked for you =) [he gets credit and so others will know the issue was resolved]