Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: vidjogamer on May 10, 2014, 07:49:14 AM
-
Hello, I am dynamically setting which sprite to use based on the data I am loading into my game. I have gotten to the point where all my sprites for this atlas, dont all fit within the max size (4096). So Im wondering if there is built in way to deal with this? Can NGUI figure out which atlas a sprite is in? Or do I have to program this myself? Suggestions?
-
Nope, NGUI doesn't handle this itself, neither does Unity for that matter.
If you're getting to those sizes, you really gotta ask yourself if there are sprites in there, that should rather be textures. Anything over 300x300 might as well just be there own texture. Alternatively, you can start segmenting your atlas into smaller atlases in logical chunks, so all sprites for a certain screen or set of screens are in the same atlas etc.
-
As Nicki mentioned, it's simply not possible to have textures greater than 4096x4096 in Unity.
-
Yes, I understand this. I'll try to better explain what I am trying to do. I am loading in a text file, based on the string I load in, I select which sprite to display from the atlas. Up until now, I could always assume everything was in the same atlas. Now that my sprites dont all fit on one atlas, I need to adjust this functionality to find the correct atlas that the sprite is in before I set the sprite. I am asking if NGUI has a way to do this, or how you would suggest I go about writing it if NGUI does not. :)
-
If my sprites don't fit into a 4k atlas, then I would remove larger sprites, making them textures instead.
If all your textures are large, then I wouldn't bother making an atlas at all.
Atlases are to optimize drawing when you happen to be using a lot of small elements on the screen.
-
I suppose if you assume the text you get is unique, you could have a tool pre-compile a list of all spritenames and match it to those and when you need to set it, you set both spritename and atlas.