Jump to content

loader on process load twice?


rossi46
 Share

Recommended Posts

loader.add("json/items.json").load(setup);
loader.on("progress", progress);
function progress(){
	console.log(loader.progress);

I monitor loader progress when load assets. I use code above. why function progress call 2 times?? It have 2 message in console log is 50 as picture attached. It is bugs???

progress.png

Link to comment
Share on other sites

Because 2 assets are loaded, the json manifest and the image it references. PIXI has a middleware parser that parses the json, sees it is a spritesheet, and adds the image it references to be loaded as well. Then, once loaded it creates textures for all the different frames of the sheet.

Link to comment
Share on other sites

14 hours ago, xerver said:

Because 2 assets are loaded, the json manifest and the image it references. PIXI has a middleware parser that parses the json, sees it is a spritesheet, and adds the image it references to be loaded as well. Then, once loaded it creates textures for all the different frames of the sheet.

Thanks. How to check total file will be loaded before loading. Why max of loader.process is 50 ( it should be 100%) ???? 

https://github.com/pixijs/pixi.js/issues/3579

here is the bugs but noone fixed?

Link to comment
Share on other sites

It is fixed, make sure you are on the latest version of pixi. There is not currently a way to tell what the number of resources will be before loading, because we can't know how many there are until we load some. For example, that json file could be just 1 resource (just the json), or 2 resources (json + image). No way to know until after we load the json.

That is why the progress event should let you know what the progress is, so you can do a loading bar based on that number and not worry about trying to calculate based on number of resources.

Link to comment
Share on other sites

21 hours ago, xerver said:

It is fixed, make sure you are on the latest version of pixi. There is not currently a way to tell what the number of resources will be before loading, because we can't know how many there are until we load some. For example, that json file could be just 1 resource (just the json), or 2 resources (json + image). No way to know until after we load the json.

That is why the progress event should let you know what the progress is, so you can do a loading bar based on that number and not worry about trying to calculate based on number of resources.

I use pixi version 4.3.4. Many people  Calling @englercj  on last comment of this issues:

https://github.com/pixijs/pixi.js/issues/3579

 

It do not fix in version Pixi 4.3.4. 

Link to comment
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.

Guest
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.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...