How to avoid adding Trash_Components to array?

Hello!
I hope you can help me. For example of problem I create a simple Blueprint and in it’s ConstructionScript I made loop that adding StaticMeshComponents to array. I promote that array to variable (SMC_Array) and made it public. The problem is:
When I’m moving my BP in Editor Viewport, I can see that many components are adding to my array. In Details panel I can see names of that components: TRASH_StaticMeshComponent (and after some time their names change to None) and the StaticMeshComponent that I really need - Pillars 50x100 in my case. When I’m tried to use SMC_Array in another BP, without removing this unnecessary components Unreal begins to take too much memory and sometimes crushs. I can click Remove All Components in the Details panel and this bad components will dissapear and everything will be Ok (untill I don’t move my BP again) , but I can’t do this all the time - this isn’t a solution. I tried to resize my array by last loop index, but in some cases i still see that Trash_Components are in the middle of array. I also made many BP using ChildActorComponents instead StaticMeshComponents and have the same problem - Trash_(SMesh,ChildActor…)Components in array. How to avoid this and still have access to each added component via array? Thanks for your answers!

If you have haven’t got this yet, you can simply fix this by setting the array to nothing with a make array, remove the default pin in that, and it will work, the only problem every time you move it it will update. You can stop this several ways, the easiest is to put a branch and have an exposed var that says allow it to make new static mesh components or don’t.

However, you could do a check to see if your static array mesh == your desired amount of static meshes. If it doesn’t, add to the end of the array until it does with a forEach loop starting at the length of your current array plus one, and if you have to take away, use a while loop until the number of instances in your static mesh array is no longer greater than your desired amount.

If you have haven’t got this yet, you can simply fix this by setting the array to nothing with a make array, remove the default pin in that, and it will work, the only problem every time you move it it will update. You can stop this several ways, the easiest is to put a branch and have an exposed var that says allow it to make new static mesh components or don’t.

However, you could do a check to see if your static array mesh == your desired amount of static meshes. If it doesn’t, add to the end of the array until it does with a forEach loop starting at the length of your current array plus one, and if you have to take away, use a while loop until the number of instances in your static mesh array is no longer greater than your desired amount.

Let me know if you get it and if you need blueprints on it I can assist. Actually, I made a video doing some very similar work but haven’t post it yet. I’ll send the link when I do.