Method UnloadScene
UnloadScene(WorldUnmanaged, Entity, UnloadParameters)
Unload the scene.
Declaration
public static void UnloadScene(WorldUnmanaged world, Entity sceneEntity, SceneSystem.UnloadParameters unloadParams = UnloadParameters.Default)
Parameters
Type | Name | Description |
---|---|---|
WorldUnmanaged | world | The world from which to unload the scene. |
Entity | sceneEntity | The entity for the scene. |
SceneSystem.UnloadParameters | unloadParams | Parameters controlling the unload process. |
Remarks
By default this function will keep the scene and section meta entities alive and just unload the content for the sections. Keeping these meta entities alive will speed up any potential reloading of the scene. Call the function with unloadParams set to UnloadParameters.DestroyMetaEntities to destroy those meta entities and fully unload the scene.
UnloadScene(WorldUnmanaged, EntityPrefabReference, UnloadParameters)
Unload a SubScene by its weak reference id. This will only unload the first matching scene.
Declaration
public static void UnloadScene(WorldUnmanaged world, EntityPrefabReference sceneReferenceId, SceneSystem.UnloadParameters unloadParams = UnloadParameters.Default)
Parameters
Type | Name | Description |
---|---|---|
WorldUnmanaged | world | The World in which the scene is loaded. |
EntityPrefabReference | sceneReferenceId | The weak asset reference to the scene. |
SceneSystem.UnloadParameters | unloadParams | Parameters controlling the unload process. |
Remarks
By default this function will keep the scene and section meta entities alive and just unload the content for the sections. Keeping these meta entities alive will speed up any potential reloading of the scene. Call the function with unloadParams set to UnloadParameters.DestroyMetaEntities to destroy those meta entities and fully unload the scene.
The version of this function receiving an entity scene instead of an EntityPrefabReference is faster because no lookup is needed.
UnloadScene(WorldUnmanaged, Hash128, UnloadParameters)
Unload a SubScene by GUID. This will only unload the first matching scene.
Declaration
public static void UnloadScene(WorldUnmanaged world, Hash128 sceneGUID, SceneSystem.UnloadParameters unloadParams = UnloadParameters.Default)
Parameters
Type | Name | Description |
---|---|---|
WorldUnmanaged | world | The World in which the scene is loaded. |
Hash128 | sceneGUID | The guid of the scene. |
SceneSystem.UnloadParameters | unloadParams | Parameters controlling the unload process. |
Remarks
By default this function will keep the scene and section meta entities alive and just unload the content for the sections. Keeping these meta entities alive will speed up any potential reloading of the scene. Call the function with unloadParams set to UnloadParameters.DestroyMetaEntities to destroy those meta entities and fully unload the scene.
The version of this function receiving an entity scene instead of sceneGUID is faster because no lookup is needed.