Sign in to follow this  
Ninjadoodle

Dynamic loaded assets stay in memory / How to unload?

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!

 

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

I also have such a problem. It seems that even in dynamic mode the assets are kept in the memory even after the scene changes so you get that error when reloading them.

Share this post


Link to post
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!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.