How to remove instance static mesh when the player collides into a instance static mesh?

Here’s how I did it:

  1. I created a Blueprint (similar to you) with an IMSC and a Construction Script to place some Instances on the Level.
    In that Blueprint I also created a Function called RemoveInstance which accepts an Index as a parameter.

    image

  1. In my Player Character I added code to the Tick (this isn’t the best place, just good as an example) that does a linetrace forward testing for Instances - that removes any instances found:

That gives the following results:

You can see that the Index that it finds the first few times is always “0” - that is correct, when you Remove an Instance - the Indexes all shift down by one. Near the end of the video I skip one and you can see the Index found is “1” instead.

If you want more control of the Indexes after removal, checkout Hierarchical Instanced Static Meshes - they do a “RemoveSwap” which replaces the removed index with the last index (stops the others from shifting).