Cannot see full view of Screen in Unity preview

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?
alt text

I know what you’re referring to, it’s frustrating but I’ve learnt that to test it properly I either want to have the game view set to Maximize on Play or give the preview pane enough space that it will display at the correct resolution (annoying though that may be).

I’m sorry I can’t be of any further assistance.

When the game view is too small to fully display the selected resolution, it resizes itself while maintaining the aspect ratio. You need to resize the game view to the resolution you want to display. You can know whether you enlarged it enough or not by checking the “grey edges”. If all 4 sides of the game window has grey edges, selected resolution will be correctly displayed. I took 2 screenshots to better explain what I meant.

3625-gameview1.png

3626-gameview2.png