I am doing a project for iPad 3.
I have a scene with many objects (250) that use large texture (2048x2048 RGBA 32 bits, about 5 MB each).
These objects are turned off when not displayed and are activated only when needed. However when I run the app on the iPad this will immediately stop.
I tried to divide the scene into multiple scenes that are first loaded and are destroyed when no longer used and it seems to work.
There is an alternative method more efficient?
Because the objects in the scene even if no active take up memory? Is there a way to have all object into scene without they take memory?
The iOS devices have a fixed amount of memory. This memory has to be shared across all applications that are “running”. Even if the textures are not visible on the screen, they still consume memory. If the iOS detects that memory is getting short, it will ask applications to reduce the memory that they use. This can be hard for games to do. If the memory usage is not reduced, then iOS reserves the right to kill your application. Check to see if you get an onDidReceiveMemoryWarning. If you have received one of these, then it means iOS is worried about memory. After this happens, the chances that your app is killed are very very very high. I usually tell customers that once they have received this message, all bets are off.
The thing you need to consider is whether you need all 250 textures in memory at the same time. Is it possible to see these textures all at the same time? Or switch between them quickly? Why not have 64x64 thumbnails, and display those, and only load the hi-res textures (using WWW) when you really need them in memory? You’ll have to destroy them once they are no longer needed.