xTiming Posted May 9, 2017 Share Posted May 9, 2017 As of one of the latest versions of Pixi (I'm not sure which as I just recently updated) the version of resource-loader was updated and the old loader functionality which used to just warn the developer was deprecated is now removed entirely. In this new version the loader now prevents you from adding new resources to the queue while the loader is running and throws this error: Quote Cannot add resources while the loader is running. For the multiplayer web game I'm currently creating I need to load resources on the fly. This pattern of loading resources is unpredictable at best as it involves multiple factors: the player changing maps, loading players currently on the map the player enters, players who are already loaded (or not) changing their appearance (the game also features custom appearance graphics the players can upload so I can't just load all appearance files at the beginning), new players entering the level and other events/effects that may result in resources being loaded. With the previous version of resource-loader I could simply just add each resource to the queue as it is needed and load it directly, or shortly after. However now if for example, a map happens to be added (the player switches maps) as the loader was busy loading a player's appearance from the old level, I get the above error and whatever was trying to add that resource throws an exception. What is the proper approach to unpredictably loading resources on the fly? Am I missing something and the current approach should actually work? Should I just add an onComplete callback that loops back to a method which is managing a queue of needed resources and load them in batches after each load is completed? Is there another suggested method? Thanks. Quote Link to comment Share on other sites More sharing options...
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.