- Home /
Texture2D.PackTextures() - maximumAtlasSize
The manual says PackTextures() will create an atlas that has a maximum size of maximumAtlasSize, if the textures don't fit in there they will be downscaled. I have some rather long animations, that would require an atlas that is at least 2048x2048 pixels big. However for some reason PackTextures() will always create a 1024x1024 texture and downscale everything to fit in there. The result is suboptimal at best. If I pass 2048 or 4096 as maximum size it will still generate a 1024 texure. If I set it to a smaller value (e.g. 512) it will create a smaller texture (512x512). So the question is how do I get PackTextures() to create textures of sizes > 1024x1024??
Are you building to Unity iPhone? I can't imagine Unity would limit your atlas sized based on your build settings, but you could check.
You are correct. When I switch to Standalone the behaviour is as expected. However it's a bit annoying that atlas size gets limited to 1024 on iphone automatically, as I wanted to create a special "HD" version for ipad and iphone4 using 2048x2048 textures because with the higher resolution my units look pixelated. i guess I'll do the import in a separate project and just copy the textures to my main project.
If you write this down as an answer I'll accept it and give you the rep points.
I have discovered that, when this function is called in a Headless, batchmode instance of a unity game for Linux (x64 tested here), it cannot PackTextures of size > 1024x1024. However, when Headless tick is unchecked in Build Settings Window, it can PackTextures of any size and also without opening any window with -batchmode command.... However, you will probably need to launch it with xvfb as stated here: http://answers.unity3d.com/questions/353653/can-a-unity-game-be-started-over-ssh.html , but it works!
Answer by SeikoTheWiz · Oct 05, 2012 at 10:13 AM
you can actually switch your project to pc and mac standalone, build in any size you want and then use the texture created in 2048 or 4096 on iphone just fine