Crash When Unloading World Partition Cell with PCG Partitioned Actors Referencing Blueprints

Hello,

I’d like to report a crash occurring in Unreal Engine 5.6.1 when unloading a world partition cell that contains PCG Partitioned Actors referencing Blueprint classes.

Prerequisites:

  • Unreal Engine version: 5.6.1
  • A World Partition level
  • A PCGComponent configured for partitioning and set to be load as preview
  • The PCG graph scatters Blueprint actors (not static mesh actors)
  • A Level Instance placed in the same cell

Steps to Reproduce:

  1. Instantiate an actor with a PCG graph in the world.
  2. Configure the PCGComponent to scatter Blueprint-based actors.
  3. Place a Level Instance in the same world partition cell as the PCG actor.
  4. Save the level.
  5. Generate using the commandlet.
  6. Open the level
  7. Load the cell
  8. Unload the cell and observe the crash.

Crash Details:

During the unloading process, the following sequence occurs:

  1. The PCG subsystem is notified.
  2. Mapping info (e.g., FPCGActorAndComponentMapping) is removed.
  3. The PCGComponent of the partitioned actor is asked to remove its reference.
  4. A cleanup is triggered.
  5. The cleanup calls AddResources, which attempts to load resources already unloaded PCG Managed Actors
  6. This results in an assertion failure, as async loading is not allowed during garbage collection.

Please let me know if additional logs or a minimal reproduction project would help. I’d be happy to provide more details.

Hi Hugo,

I was unable to repro the issue, could you provide a sample project reproducing this issue?

Cheers,

Patrick

We could but unfortunately, we don’t have the bandwidth at the moment.

I am not seeing the callstack in the thread. Can you confirm you received it as I remember sharing it when filling the message?

Also, this is only happening when,

  1. A PCG Partition Actor is loaded in a region that also has a Level Instance loaded nearby
  2. Unloading the area, would trigger the LI to unload, and causes GC
  3. GC causes the Original Component to unload -> Which causes Partition Actor to Unregister and Remove its Graph Instance
  4. RemoveGraphInstance always attempts to Cleanup Local Components. 5.6 introduces a feature to force-load unloaded actors when cleaning up, causing the assert

As a temp fix, we added a garbage collection check in APCGPartitionActor::RemoveGraphInstance(UPCGComponent* OriginalComponent)

if (!IsGarbageCollecting())
{
    LocalComponent->CleanupLocalImmediate(/*bRemoveComponents=*/true);
}

Ok, we will follow up if we manage to repro and fix.

Cheers

Hey,

I managed to repro and a fix is going to be submitted to 5.7.

I can link it here once it goes in to UE5/Main.

Cheers,

Patrick

Hey Hugo,

CL 46695194 in UE5Main has the proper fix.

Fix is also part of upcoming 5.7 release.

Thanks again for reporting.

Cheers,

Patrick

Thanks Patrick for your help! We’ll take a look at your fix.