- Home /
Background texture size in mobile phones?
I use the following C# code to attach background image to the scene to make 2D game menu:
void OnGUI() {
// display bg texture
GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height),
backgroundTexture, ScaleMode.StretchToFill);
}
The code is attached to Main Camera, with backgroundTexture
mapped to a JPG.
Since mobile phones ( plan to support iOS & Android ) have different size & aspect ratio, what size should I make the background texture? Portrait orientation will be used.
p.s. I don't want to use StretchToFill
, but I want the background image covering whole screen, while part of images (especially left & right) cropped by screen is acceptable.
Planned supported resolutions:
Android: from 800x480 to 1920x1080
iOS: from 640x960 to 640x1136 (no need to support iPad)
Your answer
![](https://koobas.hobune.stream/wayback/20220613131857im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Display GUI texture on specific variable value? 0 Answers
How do I make the size of GUI objects the same across all resolutions? 3 Answers
water mark texture 0 Answers
Help with destroying guiRect? 0 Answers