Including Only The Necessary Files Based on Device PPI/Resolution

I want to ensure that the user gets the correct image resolutions based on their phone’s specifications. In other words, if their smart phone has a high ppi and a high resolution, I want them to have the best images. I don’t want a user to have better graphics if they can’t display them. This is to save space and processor time. How do I do this in Unity?

ie. old iPhones will have lower resolution images
ie. new iPhones will have medium/high quality images

I understand that I can use Platform Dependent Compilation to make sure that some scripts only run on certain platforms, like this:

#if UNITY_IPHONE // some code that will be compiled only for iPhones #endif

Can this code be extended to only include the neccesary image files?

I create the highest quality image files (high ppi). When the program runs for the first time, I scale these images down to the appropriate PPI and replace the originals with the scaled down version. So, the initial download will be slightly larger but after the first run the entire size of the program will be reduced slightly. Is this the way to do it? Is there a better way? I don’t want to use asset bundles.



We tackled this using AssetBundle Variants.
If you want to know how it works, check out this link :

Kind regards

Koen Matthijs