# Problems with remove instance function (ISMC)

**URL:** <https://forums.unrealengine.com/t/problems-with-remove-instance-function-ismc/410810>\
**Category:** Asset Creation\
**Tags:** unreal-engine, Instanced-Mesh, question\
**Created:** [November 28, 2017, 4:08pm UTC](https://forums.unrealengine.com/t/problems-with-remove-instance-function-ismc/410810 "2017-11-28T16:08:12Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![hoppang](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@hoppang](https://forums.unrealengine.com/u/hoppang)\
**Post date:** [November 28, 2017, 4:08pm UTC](https://forums.unrealengine.com/t/problems-with-remove-instance-function-ismc/410810/1 "2017-11-28T16:08:12Z")

</div>

I do not know if this is my fault or engine bug because I am new to Unreal.  
I’ll post it to a bug report topic, but if it’s wrong, please just point it out.

**Steps to reproduce**

- Create **Instanced Static Mesh Component** , and Call Add Instance function to creates multiple items. Let’s say 5.

![221705-pic01.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/b/0/bb06e2a4be5904e8c55766d3b1c576b1df7b87d4.png)

- And call Remove Instance to delete what’s in the middle.  
Let’s say 2. The middle is removed.

![221707-pic02.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/3/5/935e02dda0b91f8c426ec9905dcf7338c6a77928.png)

- Add new instance. I just added and it is successful, but the last instance is lost.

![221708-pic03.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/4/f/94f085e67c4927387783c8234439bb8388d3e6df.png)

No, it looks like it’s been removed, but it’s still there. Collision occurs,  
I just can not see the mesh.

At this point I noticed that the contents of the UInstancedStaticMeshComponent::InstanceReorderTable array are as follows:

0:0 (index:instanceIndex) / 1:1 / 2:3 / 3:4 / 4:4

I think this value should not be duplicated, but I’m not sure.

- And remove the instance I just added.

![221709-pic04.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/4/5/945e6fa224685bfaebd13c5ccd48e99a2f1f8838.png)

Start with 5, remove 2, add 1, so it should be 4. But the result is three.  
(and one invisible mesh)

I may be totally wrong about Instanced Static Meshes. Is it an unacceptable behavior to remove instance in the middle?  
However, the official document does not say such a thing, I searched the forum, but there was no related comment.

---

<div class="post-metadata">

**Author:** ![Akyton](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Akyton](https://forums.unrealengine.com/u/Akyton)\
**Post date:** [November 28, 2017, 11:18pm UTC](https://forums.unrealengine.com/t/problems-with-remove-instance-function-ismc/410810/2 "2017-11-28T23:18:30Z")

</div>

I’ve had the same issue for quite a while. I’ve literally tried everything bar messing with the engine itself. See my post here: [Certain InstancedStaticMeshComponent instances don't render in the correct place when I add and remove instances in realtime? - Rendering - Unreal Engine Forums](https://answers.unrealengine.com/questions/707426/certain-instancedstaticmeshcomponent-instances-don.html)

The only solution I’ve come across so far is to ClearInstances() and readd them all during any frame you call RemoveInstance(), but that’s more of a hack than anything.

---

<div class="post-metadata">

**Author:** ![hoppang](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@hoppang](https://forums.unrealengine.com/u/hoppang)\
**Post date:** [November 29, 2017, 2:48am UTC](https://forums.unrealengine.com/t/problems-with-remove-instance-function-ismc/410810/3 "2017-11-29T02:48:49Z")

</div>

Hi Akyton, thank you for your comments.  
Your solution works well, but It’s difficult to use for large chunks. I need to find a better way for my purposes.  
Anyway thank you once again.

---

<div class="post-metadata">

**Author:** ![TJ\_V](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/tj_v/32/1008648_2.png) [@TJ\_V](https://forums.unrealengine.com/u/TJ_V)\
**Post date:** [December 5, 2017, 3:03pm UTC](https://forums.unrealengine.com/t/problems-with-remove-instance-function-ismc/410810/4 "2017-12-05T15:03:58Z")

</div>

Hi hoppang,

Thank you for the report. I was able to reproduce this behavior so I’ve created [JIRA UE-53053](https://issues.unrealengine.com/issue/UE-53053). Our developers will be investigating further. Follow that link to monitor the status of the report.

-TJ

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_7894e380](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_7894e380](https://forums.unrealengine.com/u/anonymous_user_7894e380)\
**Post date:** [December 6, 2017, 2:10pm UTC](https://forums.unrealengine.com/t/problems-with-remove-instance-function-ismc/410810/5 "2017-12-06T14:10:10Z")

</div>

Thanks. It would be really great if this was fixed.
