Payload β
When loading full rooms using RoomLoader.Load(), the method returns a RoomLoaderPayload()
instance - a struct that stores the IDs of all created layers and their elements and provides methods organized into the following sections:
- Depth allows you to shift layer depths to be above or below a certain layer or depth.
- Getters provide options to retreive an ID of any loaded layer or element.
- Cleanup is used for cleaning up loaded contents. This is also often called "unloading" or "destroying" a loaded room.
WARNING
The RoomLoaderPayload()
constructor is intended for internal use by the room loading system and should NOT be instantiated manually outside of its designated context.
TIP
This default behavior can be changed if you set the ROOMLOADER_DELIVER_PAYLOAD config to false
. When disabled, RoomLoader.Load() will return Undefined instead of a Struct.Payload.
Disabling this can improve loading performance at scale, since element IDs are no longer tracked.
This is especially useful when you're loading MANY elements at scale and cleanup isn't needed, like when you know that switching rooms will automatically remove all loaded elements.