- Home /
Scaling resolution for Mobile devices using UI elements
I have an issue where my [UI] buttons are rescaling improperly on multiple devices and are off-screen. I am building for android and have tested on the galaxy s3 and galaxy s6. I have my main camera on orthographic projection and Unity 5 buttons. I have 2 buttons, one on the far right of the screen and one on the far left (entire buttons do not appear on portrait view, half of each button appears on landscape view).
tldr: Is there some scripting I have to do and attach to the main camera or is there a setting on the buttons that would automatically rescale properly based on the screen size?
note: I created these buttons in the game scene by going to the Hierarchy -> Right Click -> UI -> UI Button
You have to set up your canvas to scale with screen size canvas scaler : ui scale mode -scale with screen size, and maybe have the render mode : "screen space camera".
When you place a button by default, it is placed in absolute coordinates. You have to use anchors that are taking percentages of the width and height.
you can find a lot of documents and tutorials about this issue. here is one! about canvas
Answer by tauqeerahmed · Aug 29, 2015 at 08:40 PM
You can use Canvas in unity 5 to auto scale according to the screen size
Your answer
Follow this Question
Related Questions
Ui image appear and disappear on trigger 1 Answer
Failed to re-package resources even I make blank project 3 Answers
How to implement a tutorial view pager with circular indicators in unity? 0 Answers
Use different sprites in new Unity UI for SD vs HD 2 Answers
How to make Input.GetAxis work on certain area only? 0 Answers