Hello, I’ve noticed a significant behavior change in UE 5.6 regarding when GameThread tasks execute during level transitions, and I wanted to confirm if this is expected behavior.
What Changed: In UE 5.5, during FlushRenderingCommands(), the code used FRenderCommandFence::Wait() which defaulted to Wait(false) - meaning it did NOT pump the GameThread task queue. In UE 5.6, this was replaced with FFrameEndSync::Sync(), which uses FRenderThreadFence whose destructor calls Fence.Wait(true) - forcing GameThread task queue pumping.
The Problem: This change causes GameThread tasks to execute at a different time than before. Specifically, during map loading:
- UEngine::LoadMap() is called
- UEngine::SetCurrentWorld(nullptr) makes the world context null
- RHICommandList.FlushMemory() / TrimMemory()is called
- This triggers FlushRenderingCommands() → FFrameEndSync::Sync()
- The destructor forces Wait(true), pumping the GameThread task queue
- Any queued tasks now execute while GetWorld()returns null
Previously, these tasks would execute later after the new map was loaded and the world context was valid.
Question: Is this aggressive pumping behavior during the null-world period intended? If so, what’s the recommended pattern for handling tasks that depend on world context being valid? Our code queues tasks to the GameThread that expect world/game instance to be available, and these now crash during level transitions because they execute while the world is null.
Thanks for any guidance!