Severe Performance Degradation When Adding/Removing Prefab Entities After UEFN V38.0 Update

After update V38.0, adding and removing entities in the world started to cause severe server degradation.
I’m developing a procedural system that relies on spawning and removing Prefabs dynamically. Each prefab contains several child entities with components (static meshes, logic, etc.).
Before this update everything worked fine but now the performance cost increased drastically.

Using Verse profiling, the average cost to add just 1 prefab to the world is now around 300 ms, and the value keeps increasing over time until the session eventually crashes.

Please select what you are reporting on:

Unreal Editor for Fortnite

What Type of Bug are you experiencing?

Stability

Steps to Reproduce

Steps to Reproduce

Create a Prefab and add several child entities with static_mesh_component and simple logic.

Use Verse to spawn this prefab dynamically.

Add and remove this entity repeatedly from the world.

Use profile() in Verse to monitor performance.

Observe that each add/remove iteration increases the cost progressively

Example Verse code for testing:

tile_spawn_debug_device := class(creative_device):

@editable
DebugButton : button_device = button_device{}

@editable
Entity : ?entity = false

OnBegin<override>()<suspends>: void =
    DebugButton.InteractedWithEvent.Subscribe(OnDebugButtonPressed)

OnDebugButtonPressed(Agent : agent):void=
    spawn:
        RunSpawnTest()

RunSpawnTest<public>()<suspends>: void =
    loop:
        profile("TileDebug:InstantiatePrefab"):
            spawn:
                TrySpawn()
        Sleep(2.0)

TrySpawn()<suspends>:void=
    if(HasEntity := Entity?):
        if (Sim := GetSimulationEntity[]):
            Sim.AddEntities(array{HasEntity})
            Sleep(1.0)
            HasEntity.RemoveFromParent()

Expected Result

Spawning and removing prefabs should maintain stable performance, with consistent profiling times similar to previous versions (V37.x and earlier).

Observed Result

After the V38.0 update, every Add/Remove operation increases the processing cost exponentially.

Average time per spawn rose to ~300 ms (and growing).

The degradation accumulates over time.

Eventually the island crashes due to performance exhaustion.

Platform(s)

Windows (UEFN / Verse)

Video

Additional Notes

This issue directly affects any use of dynamic prefabs in Verse.
The problem appears before the prefab even finishes spawning simply instantiating the entity already spikes the profiling cost.

The status of FORT-1008932 changed to ‘Needs Triage’. We’ve confirmed the issue and it’s waiting to be assigned to someone to fix it.

Im getting a similar client crash, can you pull your fortnite client logs and search for “fatal error” or “total uObjects”, and see if you are getting the “Maximum number of UObjects (2162688) exceeded when trying to add 1 object(s), make sure you update MaxObjectsInGame/MaxObjectsInEditor/MaxObjectsInProgram in project settings.” error? Thats what I see in my logs.

image

My issue can be followed here, seems very similar to yours. It seems individual clients continue to track entities that have been trashed and eventually run out of space. [Scene Graph] Client crashes after 10 minutes of consistently spawning and despawning entities

Also based of your video, im not really seeing the server degrade. It just continues to spit out approx 300 ms. Maybe thats slow, maybe its not, but its not getting worse as you spawn more seemingly. Your client just straight up crashes. I have this same exact issue. If I do unpublished version and play on two devices, only one of them crashes at a time. The server remain perfectly healthy, and the crashing player can rejoin perfectly fine. Then eventually the other player crashes etc. Yet the server is fine…. Very very strange.

@Flak

think I might have found a possible root cause for the crash and performance degradation when continuously spawning and despawning entities.

After testing and analyzing the logs, it seems this issue started after the V38.0 update, specifically related to the new player visibility control that was introduced.

Previously, RemoveFromParent() would fully clear the entity reference both on the server and the client.
But now, with the new functions:

(Entity:entity).SetPresentableToPlayers(Players:?[]player):void
(Entity:entity).GetPresentableToPlayers():?[]player

we gained per-player visibility control which is great, since we can now decide which players can see a given entity.

However, this also seems to be where the issue comes from:

When we call RemoveFromParent(), the server cleans up the entity, but the client keeps a rendering reference for it likely because it’s still marked as presentable for one or more players.

This would explain why performance and memory usage keep increasing with each spawn/despawn loop:
the client is retaining instances that never actually get destroyed, as their visibility references persist.

In short:

RemoveFromParent() clears the entity on the server.

But client-side, the PresentableToPlayers references remain alive.

Since V38 introduced this separation of visibility control, these lingering refs might not be getting properly cleared.

It might be worth checking whether the PresentableToPlayers state is being automatically reset when an entity is removed, or if we now need to handle that manually.