How to mass upload FBX models to a project

From a client:

We have hundreds of FBXs to update, is there an easy way to do this without doing this one by one?

There are a couple of ways I can think of doing this and due to state of the project where the FBX source assets have been deleted, only one of these is viable.

(Side note: Source assets don’t need to be deleted as they won’t be included in the build)

I was originally going to recommend using the asset update REST API to upload and update the existing FBX source assets which will in turn update the models and materials that were generated from the FBX.

In this case where you only have the Model GLB assets, this is what I would do instead assuming that the filenames of the FBX also matches the GLB in the project.

Step 1 - Generate the GLBs

  • Create a new project

  • Uploaded all the FBXs into that project and wait for all the GLBs to be generated

  • Download a build of the project

  • Unzip the build

  • Filter the folder by GLB

  • Select all the GLBs and copy into a new folder

Step 2 - Get the asset registry config

Step 3 - Mass update the GLB assets

I’ve done this with a single file but in theory this should work.

  • Write a script that loads the JSON file assets.json from Step 2 and also finds the GLBs files in the folder from Step 1
  • Use the REST API endpoint Assets - Update asset | Learn PlayCanvas to update each GLB from Step 1 using the asset id found in Step 2.The end point is strict rate limited which is 5 calls per minute. Please write the script with this in mind and I would do this operation in a branch, not master.
3 Likes