rossi46 Posted February 4, 2017 Share Posted February 4, 2017 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??? Quote Link to comment Share on other sites More sharing options...
xerver Posted February 4, 2017 Share Posted February 4, 2017 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. Quote Link to comment Share on other sites More sharing options...
rossi46 Posted February 5, 2017 Author Share Posted February 5, 2017 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? Quote Link to comment Share on other sites More sharing options...
xerver Posted February 5, 2017 Share Posted February 5, 2017 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. Quote Link to comment Share on other sites More sharing options...
rossi46 Posted February 6, 2017 Author Share Posted February 6, 2017 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. Quote Link to comment Share on other sites More sharing options...
xerver Posted February 6, 2017 Share Posted February 6, 2017 Ah this was a different bug altogether, didn't notice since it was on the old closed issue. Should be fixed now in the latest dev of pixi (was fixed in v2.0.6 of resource-loader). Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.