- Home /
Device specific texture resolutions?
Unity allows me to set specific maximum width for a texture in the import setting. However, within the same category of devices - for example: Windows Phone, the memory and GPU capabilities vary a whole lot. Am I forced to assume the worst and go with the lowest device settings for texture compilation or to maintain two versions of the project or is there a neater way to go about this?
Answer by Wisearn · Dec 28, 2014 at 05:48 PM
http://docs.unity3d.com/ScriptReference/SystemInfo.html might work for Windows Phone.
I would include small/medium/big and load the textures accoarding to a % of something like SystemInfo.graphicsMemorySize if it works for WP.
Or maybe something more rudimentary like SystemInfo.deviceModel...
Getting the system information isn't really the problem as much as choosing the proper resources to load. Let's say I have 1000 different resources to load, how do I choose the proper versions dynamically so that I don't have to change the code in the game logic. Or do I have to include a new script on every sprite in the scene? That sounds like a horrible solution to me.
Normally you instantiate most things through code which lets you modify a property like this from a more central point before it's even in the scene.
It's also common to use one big "atlas texture" with lots of sprits in a giant 4k texture, in this case its also easy to "load the medium atlas texture" as your sprites would share material.
But yes if you start out sprites with no texture loaded and ins$$anonymous$$d place a script on them that has small/medium/big texture slots and loads it depending on the device, that would work as well. You could add ExecuteInEdit$$anonymous$$ode tag to it and you'll get the textures in editor by the script (through Update).
Do you know if the new UI system of Unity does this "behind the scenes". I'm assu$$anonymous$$g not though. The do$$anonymous$$ant 2D library before Unity's own (the name completely escapes me) used to pack the sprites really tight.
Your answer
Follow this Question
Related Questions
Reduce GPU Memory usage from textures 1 Answer
How can I tell how much grahics memory is available? 1 Answer
what's the conditions by main loop checked befor enter a frame works? 0 Answers
GPU Memory : Impact of Grayscale Textures 0 Answers
Texture Atlas Duplicating Because Of Material Differences? 0 Answers