SceneChunkStreamer Class

public sealed class SceneChunkStreamer : ChunkStreamer

A Chunk Streamer component which loads chunks via scenes using the SceneManager.LoadSceneAsync method.

You should never have to interact directly with this component, as the methods/properties are called/used as needed by the Streamable Assets Manager.

Properties

Name Type Description
AsyncLoadStrategy AsyncLoadStrategy

Gets or sets the Async Load Strategy, which the strategy the Streamer will use to load Asset Chunks.

ChunkDestroyer ChunkDestroyer

Gets the Chunk Destroyer associated with this component.

CompatibleWithHiearchyOrganizer bool

Returns true only if Keep Scenes Intact is false (disabled).

When Keep Scenes Intact is true (enabled), reparenting the Asset Chunks using a Hierarchy Organizer would present huge problems, and thus it is not possible to use a Hiearchy Organizer in conjunction with a Scene Chunk Streamer with this option enabled.

InvalidSceneFormatMessageLevel InvalidSceneFormatMessageLevel

Gets or sets the InvalidSceneFormatMessageLevel used by this Scene Chunk Streamer.

IsSingleFrameAttachmentPreloadRequired bool

Scene objects cannot be fully loaded/initialized in a single frame; they need one frame before they actually "exist" in the scene they're loaded into. Because of this, pre loading is required, and so this property is overridden to always return true.

KeepScenesIntact bool

Gets the value of the Keep Scenes Intact option (set in the inspector).

MemoryFreeingStrategy MemoryFreeingStrategy

The strategy for freeing memory, which basically determines if/when Resources.UnloadUnusedAssets() is called.

Methods

AwakeExtended()

protected sealed override void AwakeExtended()

Executes Awake related logic.


CreateNewUser(ILODGroup)

protected override ChunkStreamerUser CreateNewUser(ILODGroup LODGroup)

Creates a new SceneChunkStreamerUser, which is a custom type which derives from ChunkStreamerUser. This user object contains a CellString and some other data used specifically by this class.

Parameters

Name Type Description
LODGroup ILODGroup

The lod group being registered.

Returns

ChunkStreamerUser
A new user object created using the worldAssociatedWithUser as input.


DetachAndUnloadChunksFromCells(List<WorldCell>, int)

public sealed override IEnumerator<YieldInstruction> DetachAndUnloadChunksFromCells(List<WorldCell> cells, int userID)

Unloads the cell chunks and their associated scene via SceneManager.UnloadSceneAsync.

Parameters

Name Type Description
cells List<WorldCell>

The cells whose chunks need to be detached and unloaded.

userID int

The ID of the user requesting the unload and detachment.

Returns

IEnumerator<YieldInstruction>
An IEnumerator<YieldInstruction> that can be iterated over or used as a coroutine. See the YieldInstruction page for more info.


LoadAndAttachChunksToCellsInSingleFrame(List<WorldCell>, int)

public sealed override void LoadAndAttachChunksToCellsInSingleFrame(List<WorldCell> cells, int userID)

Attaches the chunks associated with the input cells to the cells in a single frame. Because IsSingleFrameAttachmentPreloadRequired is set to return true, PerformSingleFrameAttachmentPreload must be called in an earlier frame prior to this method being called.

Parameters

Name Type Description
cells List<WorldCell>

The cells whose objects need to be attached.

userID int

The ID of the user requesting the attachment.


LoadAndAttachChunksToCells(List<WorldCell>, int)

public sealed override IEnumerator<YieldInstruction> LoadAndAttachChunksToCellsInSingleFrame(List<WorldCell> cells, int userID)

Loads and attaches the objects associated with the input cells to the cells over a period of frames. using async scene loading.

Parameters

Name Type Description
cells List<WorldCell>

The cells whose objects need to be loaded and attached.

userID int

The ID of the user requesting the load and attachment.

Returns

IEnumerator<YieldInstruction>
An IEnumerator<YieldInstruction> that can be iterated over or used as a coroutine. See the YieldInstruction page for more info.


PerformSingleFrameAttachmentPreload(List<WorldCell>, int)

public sealed override void PerformSingleFrameAttachmentPreload(List<WorldCell> cells, int userID)

Pre loads the chunks needed by the input cells for the user identified by loaderID. This ensures that when LoadAndAttachChunksToCellsInSingleFrame is called in a subsequent frame, it will work properly.

Parameters

Name Type Description
cells List<WorldCell>

The cells whose chunks need to be pre loaded.

userID int

The ID of the user requesting the pre load.