Hierarchical instanced static mesh component Bugg
Hi, i think i've found a bugg with this component when you try to remove the 0 in its array.
I was making a Trail to follow an object, then i wanted to remove the trail starting from 0 in its array. It worked for the first field, but after it "removed" it, it replaced the 0, with the value that the last index in the array had. In other words, instead of 0 becoming what 1 was in the array, 0 became what the last value had. I checked it carefully frame by frame, it was quite puzzling. Then i redid the exact same thing but with instanced static meshes and it worked as it should.
I tried to redo this bugg in a clean project, but this time when i tried to remove the 0, i got an engine crash everytime. Here's the project i redid it in, you add instances with T and Remove with R. Associated blueprints are in content browser root folder.
All the best!
asked Jan 15 '17 at 03:08 AM in Bug Reports
I've reproduced the problem that you reported using your project and it definitely does seem like a bug. I've placed a report in which you can find here: UE-40693 You can track the bug's progress there as well.
Have a nice day!
answered Jan 16 '17 at 07:48 PM
Matthew J ♦♦ STAFF
I ran into this issue as well, and I've come to the conclusion that this is not in fact a bug, but is in reality a lack of proper documentation for the HISMC RemoveInstance() method.
What's happening is that internally, the HISMC array is removing the instance using TArray.RemoveAtSwap(int32 index). This is an array removal operation that indeed removes the array item at index, then replaces it with the item that is at the end of the array: https://docs.unrealengine.com/latest/INT/API/Runtime/Core/Containers/TArray/RemoveAtSwap/2/index.html
RemoveAtSwap() is far more efficient than RemoveAt(), which is probably why it was used.
One way to work with this is to store your reference data for the HISMC instances in a TArray, and simply use RemoveAtSwap() to remove your data in your array, to mirror the state of the HISMC internal array.
answered Jan 01 '18 at 03:10 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here