Give Page Feedback | API

Chunk Destroyers - Overview

Chunk Destroyers are special components that can grant you greater control over the way game object Asset Chunks are destroyed when they are no longer needed and passed to Chunk Streamers. By default, only the Prefab Chunk Streamer and Addressable Prefab Chunk Streamers make use of Chunk Destroyers, however you are free to create custom Chunk Streamers that also make use of them.

Why Use A Chunk Destroyer?

The default logic (when not using a Chunk Destroyer) is for the Prefab Chunk Streamers to destroy the root Asset Chunk's belonging to each Cell directly. If you have simple Asset Chunk hierarchies (no child game objects of the root Asset Chunks, for instance), this strategy will work just fine, however if your Asset Chunk hierarchies are complex and contain a lot of child game objects, this strategy will destroy all the game objects in one frame, which may cause performance issues.

The Chunk Destroyer allows you to control exactly how your Asset Chunk hierarchies are destroyed, and you can do so over multiple frames to limit the performance impact.

Since you have intimate knowledge of how your hierarchies are designed, you can design the perfect logic for destroying those hierarchies without affecting performance.

What If I Don't Want To Use A Chunk Destroyer?

It's just fine if you don't want to use a Chunk Destroyer. The default logic of the Prefab Chunk Streamers is to destroy each Asset Chunk 1 by 1. After each destruction, memory may be freed (depending on the Memory Freeing Strategy used) and the Chunk Streamer might yield for a frame or continue destroying chunks (depending on the Execution Controller you are using).

If your Asset Chunks do not have deep hierarchies, it can be a good idea to avoid the use of Chunk Destroyers.