Hi all,
I have been making a 2D sprite-based game in Unity for a couple of months now, and this issue is really starting to get in the way.
First off, here are some stats that may be relevant:
Game’s target resolution: 1280 x 768
Unity Player settings: 1280 (width), 768 (height)
Unity Game preview pane setting: Standalone (1280 x 768). I am aware of Maximize on Play and use it almost all the time. The problem persists.
Camera Settings: Projection (Orthographic), Camera size = 384
The issue is this: I cannot seem to get a full view of the screen in the unity Game view preview pane. This is most apparent when I script GUI elements through OnGUI(). In fact, all the game world assets show up fine, its only the GUI that doesn’t show up right. It seems like Unity is only showing the top left part of the screen but it tries to squeeze in all the GUI into the preview screen despite it not fitting. Especially when I code in values like Screen.height and Screen.width.
Here is one example: When I want something to be on the bottom left corner of the screen, I code something like this.
if (GUI.Button(new Rect(0, Screen.height - 60, 682, 73), "Level Select"))
{
StartCoroutine ( Dofadeout ("LevelSelect") );
}
Now, I also have a texture on the left side of the screen that starts at (0, 134) and spans 574 units downward. In the Unity preview “world” the texture and button are seen as overlapping. But when I actually build the project and look at the same screen, they are as they are supposed to be. They are not overlapping.
Everything is alright in the “real world”. But the unity preview pane squeezes OnGUI elements together making it impossible for me to visually place them unless I build the game every time I want to check the “real” position of the GUI. Any help would be appreciated.
Edit: I have attached some pics for reference. First one is in Unity, 2nd one is build.
Edit2: Someone suggested something that I should have done at the beginning of this post. I scripted in some labels to reveal the actual current Screensize thorough Screen.width and Screen.height and added a third pic to show this. It was revealed that I had been working in 1063 x 638. So basically the Standalone (1280 x 768) is a straight up lie?