- Home /
Android Game screen resolution
In android development we use different image size for different screen resolutions. like hdpi,ldpi,mdpi, and so on ... How to use images for different screen resolution in android 2D game.....
Use Canvas ...
if you are not familiar with this pls visit
https://unity3d.com/learn/tutorials/modules/beginner/live-training-archive/the-new-ui https://www.youtube.com/results?search_query=unity+canvas+tutorial http://docs.unity3d.com/$$anonymous$$anual/UICanvas.html
Answer by Suraj. · Aug 14, 2015 at 06:34 AM
Did not really understand your question. However I can tell you what I do. I use screen aspect ratio as 16:9 lets say for landscape. And use UI canvas as 1280x720. And for 2D sprites, you can overide settings and limit resolution and so on. Also I would like to know which version of unity are you using?
i am using unity 5.0.0. i really want to fit my sprites to work for all android screen resolutions. I know about UI canvas but i want my sprites to work for all screen resolutions. ?
Answer by Rad-Coders · Aug 15, 2015 at 11:13 AM
If you are scripting the UI you can always draw lets say a image on the screen by saying what percentage of the screen it should be taking up so you can say something like this
void Start()
{
private float screenWidth = Screen.width;
private float screenHeight = Screen.height;
}
void OnGUI()
{
GUI.drawTexture(new Rect(screenWidth*0.1, acreenHeight*0.1, screenWidth*0.5, screenHeight*0.5), yourTexture, scalemode, true);
}
That snippet would give you a basic idea of what I am trying to say