Jump to content

Force the loading of a Texture (no cache)


Mathieu Anthoine
 Share

Recommended Posts

When I use a json (hash) to load a texture made for example in Texture Packer, I can manage the cache for the json file in adding some parameters after the json file url :

myLoader.add("myTexture.json?0.1.0");

But How can I control the extra png files (described in the json file) to be loaded again without using the browser cache ?

 

Thank you 

Link to comment
Share on other sites

  • 5 years later...

What worked for me is adding a middleware function that appends the cache-busting bit (hash, version number, timestamp) to the URL of each resource loaded:

app.loader.pre((resource, next) => { resource.url += `?t=${Date.now()}`; next(); });
app.loader.add('./textures/road-textures.json');
app.loader.load((loader, resources) => {
    // ...
}

 

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