Existing Way to add an entire directory to the Asset Registry?

Hello All,

CONTEXT: This is more of a confirmation that I was seeking before actually moving forward with the implementation since it’s a non-priority task.
I had a task to test out if it’s possible to add and entire directory of assets from an external URL to the asset registry and then load them asynchronously in the scene. I thought of approaching it as mentioned below:

function addExternalAssets(rootUrl) 
{
    // Recursively go through the entire directory and get all the asset link
    assetUrls = getAssetLinksFromUrlRoot(rootUrl);

    // Loop through all the assets and add them to the registry
    for (assetUrl in assetUrls)
    {
        // This function will internally figure out the type of the asset
        addUrlToRegistery();
    }
}

addExternalAssets(<URL>);
// After this function call we have our asynchronous load setup by asset tags and that works as expected.

Now I have two question here:

  1. Is there an existing way to add an entire directory to the assetRegistry so I don’t implement all of this again. Just wanted to be sure before I invest time in this (otherwise we will just plan to ship assets with our PC build itself).
  2. If there is no existing way to add the directory, are the methods which can figure out the asset type while adding them to the assetRegistry exposed to the Public API? Because playcanvas somehow internally does that when we upload an asset, right?

Any help would be appreciated :slight_smile:

Regards

  • Tanay Dimri

Just to check, is this for the Editor or at runtime?

Sorry forgot to mention.
At Runtime