Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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!

Product Version: UE 4.14
more ▼

asked Jan 15 '17 at 03:08 AM in Bug Reports

avatar image

18 3 4 8

avatar image Matthew J Jan 16 '17 at 06:15 PM

Hello nameLive,

Thank you for reporting this issue. I'm currently looking into it using the project you provided but I wanted to let you know why the project was crashing. When you went to populate the array, the Hierarchical Instanced Static Mesh didn't have a Static Mesh set, so it was essentially creating blank instances. When the remove function tried to access them, it saw an empty array and crashed. Setting a static mesh fixes this.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

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!

more ▼

answered Jan 16 '17 at 07:48 PM

avatar image zEh- Sep 22 '17 at 11:19 AM

Not only has HISM this ordering bug but ISM does not correctly remove instances all the time. I am currently using ISM and waiting for the fix in 4.18 for them. But I need HISM for per-instance LOD. Otherwise I won't have any chance for near-distance geometry details. When will this bug be fixed? It's crucial for performance on visually appealing instances.

Can't this be done in the context of the ISM bug?

avatar image bennetherwood Oct 25 '17 at 06:42 PM

Bump this also, Id like a fix please, and have seen it on as UE-40693 but its been around for ages.

Thanks, Ben.

avatar image superdreamgen Jan 01 '18 at 03:11 AM

I don't think this is actually a bug, please see my answer below.

avatar image superdreamgen Jan 01 '18 at 08:27 PM

Hello Matthew,

I do not believe this is a bug, please see my answer below. In fact, if this "bug" were to be fixed, and HISMC instance arrays to switch to using RemoveAt() rather than RemoveAtSwap(), it would reduce the efficiency of not only the HISMC algorithms, but also of data structure algorithms that manage HISMC indices in game code! (e.g. only having to update the cached index of one instance, rather than ALL indices > the index that was removed!).

What should really be done are two things:

1. Update the UE API documentation for HISMC RemoveInstance() to indicate the array operation used behind the scenes (RemoveAtSwap) so that developers understand why the last element of the array is being placed into the hole in the array.

2. Update the UE API documentation for TArray RemoveAtSwap() to explain that it moves the last item in the array to fill the hole created by the remove operation.

This behavior of RemoveAtSwap() is detailed here in the UE blog: https://www.unrealengine.com/en-US/blog/optimizing-tarray-usage-for-performance

The blog article states:

"There's a way to avoid the performance hit of shifting all elements to fill in a gap when an element is removed: RemoveAtSwap(). This removes the element at the requested index, then if possible replaces it with the last element in the array to fill in the hole, rather than shifting down all elements."

Using RemoveAtSwap() is far more efficient than RemoveAt() (both internall in the engine, and within developer game code) !!! Please do not fix this "bug"!

avatar image Matthew J Jan 05 '18 at 09:11 PM

Hello superdreamgen,

Thank you for pointing this out. I'm not now, nor was I ever, very familiar with HISM so I didn't notice this but you're correct. I'll put a comment on the bug report that mentions that this shouldn't exactly be "fixed" but an additional remove function for the functionality that the other posters were expecting would be useful.

avatar image superdreamgen Jan 09 '18 at 12:53 AM

Hello there Matthew,

If they do add a RemoveInstance function that doesn't utilize RemoveAtSwap, the API doc should note that calling that function instead will lead to slightly reduced performance.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

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.

Cheers. :)

more ▼

answered Jan 01 '18 at 03:10 AM

avatar image

16 3 7

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question