Hi,
Wondering if anyone has successfully implemented this function in 5.6, and if so you could share your implementation?
Any way I’ve attempted it causes the engine to crash.
I’ve tried various things, generally along the lines of this example, often with additional logic to identify a specific instance to remove. But it always crashes on the RemoveActorInstance call.
UInstancedActorsSubsystem* Subsystem = UInstancedActorsSubsystem::Get(WorldContextObject);
Subsystem->ForEachInstance(QueryBox, [&](const FInstancedActorsInstanceHandle& Handle, const FTransform& /Unused/, FInstancedActorsIterationContext& Context)
{
if (!Handle.IsValid())
return true;
Subsystem->RemoveActorInstance(Handle, false);
});
The errors are always along the same lines of.
Assertion failed: (Index >= 0) & (Index < ArrayNum) [File:D:\UE56\UnrealEngine\Engine\Source\Runtime\Core\Public\Containers\Array.h] [Line: 1067]
Array index out of bounds: 418 into an array of size 0
Exception thrown at 0x00007FF9365EA6F4 (UnrealEditor-InstancedActors.dll) in UnrealEditor.exe: 0xC0000005: Access violation writing location 0x0000000000009CC0.
Unhandled exception at 0x00007FF9365EA6F4 (UnrealEditor-InstancedActors.dll) in UnrealEditor.exe: 0xC0000005: Access violation writing location 0x0000000000009CC0.
Interested in hearing from anyone who has successfully implemented this.