GBear Posted December 7, 2015 Share Posted December 7, 2015 hi... i can look warning from loader when reloading this code is pixi.js code into loader.add// check if resource already exists. if (this.resources[name]) { throw new Error('Resource with name "' + name + '" already exists.'); }i'm wondering why throw Error. is there problems if throw callback to complete or return 'this'..? thx a lot.. Quote Link to comment Share on other sites More sharing options...
mattstyles Posted December 7, 2015 Share Posted December 7, 2015 I suspect its just to stop you loading the same asset twice. If you really do want to reload the asset (e.g. that asset may have changed on the server, although, in this case, versioning would probably be a better solution) you could delete it from `this.resources` and carry on with your reload. You'd have to make sure the original asset isnt being held anywhere else though so that it would be a candidate for garbage collection. Quote Link to comment Share on other sites More sharing options...
xerver Posted December 9, 2015 Share Posted December 9, 2015 Because it is an error, and it shouldn't be done. The error is there to tell you as much. Adjust your code accordingly. If you want to reload an asset again, then either create a new loader or reset the one you have with the ".reset()" method. 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.