HISM index problem

I think it’s index of instance, and it auto-increment, but some time, like after removing instance many times, the return value may go low like 0 or 23, which the instance I already removed, why?

HISM indexes must live in a continuous ordered unique list. If you make a hundred, they’ll be ordered from 0-99. If you remove the 25th, another instance with a higher index will take its place and lose its own index! From an older thread of mine:

Note what happens to indexes when a random instance is removed, some other instances have their indexes reassigned. This used to be a massive issue up until 4.26 - were you to add LODs to the mix, the indexes would jumble up really quickly…


Another example from yet another thread regarding this:

Initially the spheres are ordered, their shade indicates their indexes. HISM components support per instance culling - off screen instances get removed from the index list (great for performance since we can render only some of them!). But if they’re not on the list, the HISM component needs to reorder indexes to fill in the gaps.

When they disappear on the right hand side, these are the high indexes - nothing needs rejiggling. 0-100 became 0-70 let’s say. It’s still neat.

Low indexes disappear when culling kicks on the left hand side. Now we have an index list of 30-100. The HISM will have none of that and will fill the initial indexes with something from the back. As you can see, this is quite chaotic.

The above was done using per instance custom data.