Cause and mechanism
Loading a scene asynchronously does not move every part of the transition off the main thread, where much of the game runs. Measure scene activation, object creation and destruction, unused-asset scanning, and garbage collection (GC), which reclaims unused managed memory. UnloadSceneAsync alone does not unload the scene's assets.
Check and correct the setup
- Profile scene activation, UnloadUnusedAssets, and GC separately on the device.
GC.Alloc ≠ GC time - Remove unused references before cleanup, run it during a loading screen, and await its AsyncOperation.
GC.Alloc ≠ GC time - Manage Addressables handles and consider incremental GC; avoid repeated forced GC.Collect calls.
GC.Alloc ≠ GC time
Limits and verification
An async API does not guarantee all work runs off-thread. Incremental GC does not slice asset cleanup or scene activation; pools increase retained memory.
A focused diagnostic setup
Compare transition into an empty scene with the real heavy scene and locate the hitch during loading, activation or old-scene cleanup.
Test in this order
- Inspect the slow frame, separating activation callbacks, unused-asset scanning and GC.
GC.Alloc ≠ GC time - Temporarily reduce destination spawning/initialization to test whether it drives the pause.
GC.Alloc ≠ GC time - Repeat the same transition to distinguish first-use shader preparation from recurring work and memory retention.
GC.Alloc ≠ GC time
Interpret the result
Investigate initialization for activation hitches and references/scanning for cleanup hitches. Manually invoking GC does not reduce unrelated stages. Verify loading-screen responsiveness too.