# Instanced Static Mesh, Removing Instance Issue

**URL:** <https://forums.unrealengine.com/t/instanced-static-mesh-removing-instance-issue/66187>\
**Category:** Blueprint\
**Tags:** unreal-engine\
**Created:** [June 10, 2016, 8:22pm UTC](https://forums.unrealengine.com/t/instanced-static-mesh-removing-instance-issue/66187 "2016-06-10T20:22:49Z")\
**Posts on this page:** 1\
**Showing post:** 12

<div class="post-metadata">

**Author:** ![ste1nar](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ste1nar](https://forums.unrealengine.com/u/ste1nar)\
**Post date:** [October 15, 2016, 8:45pm UTC](https://forums.unrealengine.com/t/instanced-static-mesh-removing-instance-issue/66187/12 "2016-10-15T20:45:55Z")

</div>

If I may chime in, I too had issues removing the correct instances but this relatively simple setup solved it for me:

 ![RemoveInstance.png](https://d3kjluh73b9h9o.cloudfront.net/original/3X/a/e/ae9ea663e2a6c33cfb33ac62daa0b4d550c31ddc.png)  
Explanation:  
The Int Array stores the indexes we wish to remove. Since removing a lower number will make the instances go down one position, we remove them from highest to lowest.  
We store the values that Max Of Int Array returns so we don’t have to run that function over and over (well, twice, instead of thrice).  
After removing the returned Max Value, we set the \*Item \*of the _Index_ that the _Max Value_ had to -1 so that it will not be chosen again as the _max value_.  
Also I suggest clearing the Int Array after it’s all completed.

---

_[View the full topic](https://forums.unrealengine.com/t/instanced-static-mesh-removing-instance-issue/66187)._
