Dynamic Texture and Mesh Loading

From Resonite Wiki

Do you have too many optional parts and you are afraid to hurt other people by loading too many assets by spawning out your avatar or item? Or maybe you need to optimize your world even more.

Here is a way to dynamically load and unload meshes and textures to reduce ressource usage.

The main function for this is the BooleanValueDriver<Uri>, that can be found under transformations > Drivers in your component browser.


Setup Example

In this example, a simple usecase to optimize optional clothings will be shown.

  1. Create a path/folderstructure in your inventory to save the assets you want to dynamicly load. Here is an example for textures:
    Caution: Wait for your assets to fully sync, before spawning them out again!
  2. Checking if an asset is already in the cloud or still loaded from your own storage. For our setup, we need to have the URI of the cloud.
    Here we can see that the URI link is starting with "resdb://", which means that our asset was loaded from the resonite cloud.
    Caution: If you still see "localdb://" please delete the asset and wait a little before trying to spawn it out from your inventory again.
  3. Moving the assets onto a slot, instead of letting it be in the "Assets" of the world.
    This step is needed, due to the asset cleanup not being able to identify that a nulled mesh or texture is still needed. It would delete our asset component and with it the ability to swap our asset dynamicly out.
    This is very important, if you want to keep your textures and meshes and not letting it getting cleaned up by the system.
    1. Prepare your slot setup.
      This is an example for setting up slots for meshes and textures:
    2. Move the slot of your skinnedMesh or texture2D onto the corrosponding created slot (For organization).
      You can also move textures directly into a slot via Drag&Drop.
  4. Create BooleanValueDrivers for each texture and mesh.
    The component can be found under Transform > Drivers and for our specific usecase, we need the "Uri" version of it.
  5. Copy the "resdb://..." of your mesh or texture into the true field first!
  6. Drive the Uri of your mesh or texture component with the BooleanValueDriver
    This will let us be able to toggle the Uri field to either the assetlink we need or null the asset completly.
    • Mesh example:
    • Texture example:
  7. Checking the configuration by toggling the state of the BooleanValueDriver<URI>. This can also be streamlined by using a "ValueMultiDriver<Bool>" under Relations.
    The texture2D component will also show us in the end that zero memory is being used: