RenderAssetUsages
Opaque Type. 🔒
Description
Defines where the asset will be used.
If an asset is set to the
RENDER_WORLD
but not theMAIN_WORLD
, the asset will be unloaded from the asset server once it's been extracted and prepared in the render world.Unloading the asset saves on memory, as for most cases it is no longer necessary to keep it in RAM once it's been uploaded to the GPU's VRAM. However, this means you can no longer access the asset from the CPU (via the
Assets<T>
resource) once unloaded (without re-loading it).If you never need access to the asset from the CPU past the first frame it's loaded on, or only need very infrequent access, then set this to
RENDER_WORLD
. Otherwise, set this toRENDER_WORLD | MAIN_WORLD
.If you have an asset that doesn't actually need to end up in the render world, like an Image that will be decoded into another Image asset, use
MAIN_WORLD
only.Platform-specific
On Wasm, it is not possible for now to free reserved memory. To control memory usage, load assets in sequence and unload one before loading the next. See this discussion about memory management for more details.