I get error Assertion failed: InstanceIndex < GetMaxInstanceIndex() [File:D:\build++UE5\Sync\Engine\Source\Runtime\Engine\Public\InstanceDataSceneProxy.h] [Line: 49] pls help?
When you remove an instance, all instance indexes are reordered to remove any gaps. So if you’re storing indexes and you remove one of them, ALL your indexes are now invalidated.
The error you’re getting can happen in the following example. Say you have 10 instances indexed 0 to 9. You remove index 8 causing index 9 to now become index 8. Then you try to remove index 9. Index 9 doesn’t exist anymore when you try to remove it. It is now index 8 (technically it can be any index, but usually just goes down by 1). And you get the error you got.
This is why a lot of people don’t remove foliage indexes. They just shrink them and move them underground.