Hopefully you guys can help me out a bit. I’m using an Instanced Static Mesh Component to create a lot simple meshes (quads, to be precise).
I want to be able to dynamically add and remove those instances during gameplay, and keep track of the instances.
Most of it seems to be working fairly well, logic-wise at least. However, I run into a performance issue.
Adding the instances doesn’t seem to be a problem, I can add many on every tick up to hundreds of thousands without the FPS being affected.
If I try to remove instances, I find my FPS dropping proportionately to the number of instances, and looking at the profiler, I see the mess in the first picture.
It would seem that CreateAllInstanceBodies and ClearAllInstanceBodies are both called every time I use ISMC->RemoveInstance(int32 index), or something similar.
I wanted to have a look at those functions, but I can only find the header of InstancedStaticMeshComponent, not the .cpp. See the second picture.
So, here are my questions:
What are those two functions, and why do they need to be called in this situation?
How can I access the InstancedStaticMeshComponent.cpp?
And finally, is there a way for me to remove instances more efficiently than with RemoveInstance()?