docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    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.

    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)