- Home /
GUI Overlay using mobile camera
I'm developing an AR app that uses popup windows when certain objects are pressed. I'm using GUI.Window to act as a popup window. The issue I'm having is that the resolution is massive. When I run it using Remote, the popup window looks fine on my phone but when I build and run the app from my phone, since it uses the camera, it doesn't scale properly everything becomes so tiny.
Is there any way to get around that?
EDIT: Ok so I changed my approach and used percentages and got mostly everything working. The only issue remaining is the button sizes and font sizes. I'm trying to avoid sticking to any specific aspect ratio and just trying to accommodate as many devices as possible.
Any suggestions?
Answer by falantar14 · Nov 04, 2013 at 06:18 PM
Figured it out. Basically I'm using a baseX and Y (1280x800) and hard-coding the sizes/position. Then using GUIMatrix, it re-scales them automatically based on the current resolution. Here's a sample code:
// C# Code
float baseX = 1280;
float baseY = 800;
GUI.matrix = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, new Vector3(1.0f*Screen.width/baseX, 1.0f*Screen.height/baseY, 1.0f));
Your answer
Follow this Question
Related Questions
GUI System on multiple resolutions 2 Answers
Game looks different on device compared to Game View 0 Answers
Screen Resolution and GUI cutoff issue. Android. 1 Answer
size of GUI pics too big 1 Answer
Why this simple code doesnt work? 0 Answers