Get size of loaded file when using AssetsManager

Recommended Posts

I'm using AssetsManager to load a list of files.

Is there a way to tell a loaded file's size? e.g. by the IAssetTask returned onTaskSuccess.

I'd like to avoid using SceneLoader as I'd need to create predefined .babylon files to load, and I'd like to avoid that. (assuming I understand SceneLoader properly)

Share this post

Link to post
Share on other sites


PHP is really not needed for that, I'm talking about the file size after it finished downloading, pure client side should be enough to get that information.

I know that if I create my own functions for making file requests I can access the header "Content-Length" to find the file size, but I'd like to keep using the existing bjs AssetsManager.

As far as I know bjs returns file size in SceneLoader, I have yet to find a way to get it in AssetsManager.

Share this post

Link to post
Share on other sites

I'll steal this from another topic...

if you're loading serialized files, you don't need a *.babylon file to load the mesh with SceneLoader if you have it serialized or in JSON format somehow.

var serMesh = BABYLON.SceneSerializer.SerializeMesh(taskObject.assets.tiles, false, false);
serMesh = JSON.stringify(serMesh);
BABYLON.SceneLoader.ImportMesh("", "", "data:" + serMesh, scene, function (newMeshes) {
	console.log("newMeshes: " + newMeshes);


Share this post

Link to post
Share on other sites

SceneLoader seems a bit uncomfortable to me, I might be understanding it wrong though.

Is there a way to pass urls to the SceneLoader in order to load both textures and meshes, similarly to how it's done in AssetsManager? Without creating a .babylon file / serializing.

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.