I built an app and pushed it to my phone, but how it does not fit the screen/auto scale properly as it does for the Unity Game Scene. That being said I feel like this would be a common problem and I had simply assumed unity would do the scaling for me when I pressed build and run for Android.
I am using 3D Text with custom fonts instead of GUI texts with skins. The camera is zoomed too far out on horizontal view and too close in on vertical. Would I absolutely have to use gui skins or is there still hope?
I ran into a lot of these same issues with my first project (though it was 2D), particularly problems with making texts the right size on any device and scaling the camera to fit on any aspect ratio. After a lot of reading discussions on the topic, and banging my head against the wall, I kinda implemented my own really simple set of systems to deal with it. Not sure if these are exactly relevant to your problems…
To deal with general camera size, I just detect the aspect ratio (Screen.height / Screen.width) and manually adjust the camera size to keep the important stuff visible in the viewport, though this will be different for every project.
For the texts, I actually created an empty gameobject with a BoxCollider2D on it that just sits in my scene. When the game starts, I use some basic code to detect how wide this collider is in pixels, something like this:
Then I have a script attached to basically every UI text that sets the text’s font size equal to some ratio of textScalerWidth:
GUIText myText;
public TextScaler textScaler;
public int inverseTextSize;
void Start()
{
myText = guiText;
myText.fontSize = textScaler.textScalerWidth / inverseTextSize;
}
Just make sure these scripts execute in this order (use the script execution order). This is of course kinda specific to a 2D scene, but it would work the same in 3D as long as your collider object was locked to the camera.
Sorry if that wasn’t quite relevant to what you’re trying to do.
What is your camera mode Orthographic or Perspective? [Dharmesh][1] [1]: http://www.variyasoftsolutions.com/unity3d.html
– LearnUnity3dPerspective
– kuos