Delete Instanced Meshes while replacing them

Hi,

i have a huge set of Hierarchichal Instanced Meshes and if an actor on fire (actor) comes near them, they get replaced by tree actors with the same transformation, so they can catch fire too and be destroyed and by chance set other actors on fire. There are a lot of fires, so there is a lot going on in the HISM components.

When a actor catches fire, all surrounding HISM (Hierarchical…) are replaced by the “Get Instances Overlapping Sphere”. The indices are being stored in an array so i can remove them one by one after i spawned the same actors.

With that i dont have to spawn thousands of actors in the beginning. They are only replaced if necessary.

Is it true, that it think it might happen, that the array of instanced meshes can be corrupted when at one place an instance is being deleted while another actor is in the middle of replacing HISM with actors? Because deleting HISM might change the array and the indices.

Here is the function:

This is the part where a actor set on fire replaces its surrounding HISM with actors. The “Remove Instance” Call is in the “Set Tree Basics” function.

I imagine while one actor is in the for each loop, another actor might delete another HISM and the array is corrupted. Is it possible? What can you do to prevent that?

Sorry for my bad english.

Thanks in advance