Hi everyone,
We’re working on a Unity project using DOTS (Entities 1.4.0) and have a question regarding how to properly load subscenes into the correct Unity scene when using SceneSystem.LoadSceneAsync.
Context:
-
We have two Unity scenes:
MainMenuScene: Contains the main menu UI, lighting, camera, and post-processing volumes.GameplayScene: Contains gameplay-specific config, camera, lighting, and its own post-processing stack.
-
When a player starts a session:
- We load
GameplaySceneasynchronously usingSceneManager.LoadSceneAsync(..., LoadSceneMode.Additive)to avoid a noticeable freeze. - Once
GameplayScenehas finished loading, we load a DOTSSubSceneusingSceneSystem.LoadSceneAsync.
- We load
Problem:
The DOTS subscene ends up being linked to the MainMenuScene, which is still the active scene at that point.
This becomes a critical issue because when we unload the MainMenuScene (after transitioning into gameplay), all entities loaded through the subscene are also destroyed, since their lifetime is tied to the scene they were linked to — in this case, the wrong one.
We want the subscene to be correctly associated with the GameplayScene so that its entities are preserved when the main menu is unloaded.
Question:
Is there a way to control or specify which Unity scene the subscene is “linked” to when calling SceneSystem.LoadSceneAsync?
Or is there a recommended workflow or best practice in DOTS to ensure the subscene is safely and explicitly associated with the gameplay scene, especially when using additive scene loading?
We’re deliberately avoiding LoadSceneMode.Single due to freezing/stalling, and are aiming for a smooth transition experience.
Any advice or guidance would be appreciated.
thanks!