I just want to check if this is working as intended.
I have a blueprint class that can be destroyed during gameplay and that has a mesh which is identical for each instance of the blueprint. I wanted to optimise this by having a single Instanced Static Mesh for the level, having each blueprint add instances to it and store the index values of the instances. When the blueprint is destroyed it would call remove instance on the instanced static mesh for each index it holds to remove them.
The issue I’m having is that removing an instance from the Instanced Static Mesh shuffles the index values of every remaning index above it by one, like a dynamic array. This causes some of the stored index values in my blueprint class to be incorrect.
Is this behaviour intended? I can think of a way around it by creating an array which holds a reference my blueprint class, adding elements each time I create an instance and removing the elements related to each lueprint when I delete instances. That should meant that the indices for that array match the instanced mesh indices, but it seems like a lot of trouble to go to.
Am I over-thinking this - should each of my actor blueprints just have its own instanced static mesh component and call clear instances on it when it’s destroyed? Will I get the benefit of instancing in this case, or do I need to have one instanced static mesh component and add all the instances to that to get the benefit?