Jump to content

Dynamic loaded assets stay in memory / How to unload?


Ninjadoodle
 Share

Recommended Posts

Hi Guys

 

If I add all my images into an assets.js file and 'require' the file, does this mean that all the images get loaded when the game starts?

 

Wouldn't this cause a huge spike in memory use on mobiles.

 

What would be a better way of loading assets for different levels.

 

Could I have multiple asset files ...

 

Level1Assets.js

Level2Assets.js

and so on ...

 

and then load them in each level?

 

What would be the best way of going about this?

 

Thank you heaps in advance!

 

Link to comment
Share on other sites

Hi enpu

 

Thanks for an awesome engine! I really like it :)

 

I tried using the dynamic loader, but when I change between scenes and go back to the level, it tells me that the asset has already been declared/exists.

 

I might be doing something wrong.

Link to comment
Share on other sites

HI Guys

 

I've managed to find a way around revising a level with dynamic loaded assets, but I don't think it solves the memory issue.

 

Make a global variable and check it to make sure you are only loading the assets on the first play through. Set the global var to true once the assets have been loaded. This allows you to revisit the level avoiding the message/crash that the assets already exits.

 

The problem is that the assets stay in memory which might eventually result in a memory crash (on weaker devices).

 

Is this a possible bug, or are we doing something wrong? Is there a way to unload assets before switching to the next scene?

 

Thanks heaps in advance!

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