Jump to content

Lazyloading for assets


CyberDude
 Share

Recommended Posts

In my web application (mobile platform) i have heavy assets, aprox 15mb. I there any way to load SD MD HD assets together and update textures of elements with time?
Like, we loaded SD -> use SD but load others too. Okay, MD is ready, change SD to MD. Atleast, HD is ready so use it!

Thanks for you help!)

Link to comment
Share on other sites

I do this in my apps but this is not a simple piece of code, I do have an extensive asset manager that handles that directly, here's how it works:

1. assets can have resolution from 0.25 to 3.

2. target resolution (typically 1 or 2) is set globally but can be set by code for a specific asset.

3. if only one resolution is available for that asset the assetmanager loads that one.

4. If multiple resolutions are available for that asset, the assetmanager checks if there's any resolution smaller than the target resolution.

5. If smaller resolutions are available, the assetmanaget starts loading the smallest one > when loaded > update the Sprite and starts loading the next resolution > etc .. until reaching the target resolution.

 

after each resolution load, the previous one is disposed and cleaned, the new resolution asset updates the Sprite and scale values. In addition there's a cache system that skips all that if target resolution is already available.

Like I said this cannot be done with a simple piece of code, this is an extensive system.

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