Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: Tripwire on October 20, 2013, 06:02:44 AM
-
Hi,
I'm making an app for iOS and Android and i noticed that my memory is going up a bit too high for my taste (app is still running on iOS and Android but i'm over 200MB memory).
The thing is i'm reusing a background on every screen (for like 20 screens). This texture is a UITexture with a resolution of 2048x1536 @ 32bit. It takes up 9.0MB. Now let's say i have 20 panels each with this background, these panels are tweened in when user clicks a button on the screen. All panels are turned off (only the first screen). I thought that when a GameObject is turned off it wouldn't be loaded into the memory but that doesn't seem the case.
Here is a picture of the background i'm using:
(http://www.plaatjesdump.nl/upload/423c051a14a47d6c226ddacc9c5da3a3.png)
The background is essential to the app so i can't reduce the quality, it must look crisp!
Any ideas to reduce the memory?
-
So i was brainstorming about this today, and maybe the answer is using Resources.Load on the background of the panel isn't on screen unload it. Any other sugestions?
-
You can do that screen using a single 3x3 pixel texture.
1. Create a 3x3 white square in Photoshop.
2. Add it to your atlas and give it a 1 pixel border all around.
3. Create a sliced sprite using this texture. This will be the white background.
4. Create a thin vertical sliced sprite on the side and give it a red color. This is going to be your red line.
5. Create a thin horizontal sliced sprite and give it a light blue color. This will be your blue line.
6. Duplicate your blue sprite from #5 a bunch of times, positioning it as you see fit. You can use a UIGrid to do it automatically.
-
that is actually a pretty good idea! Awesome :) i'm going to try that tomorrow.
Question2 how would you do the same with the screen below?:
(http://www.plaatjesdump.nl/upload/f84d0e2da5d543d4747818e9d3520907.png)
-
Same exact way, except you will be adding more lines, and the hole looking sprites as well.
-
Great this worked very good! Gone from 240MB memory to 160MB memory :) any other ideas to lower the memory?
-
Use less big textures. :D