Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by user5200 · Sep 20, 2012 at 05:03 AM · 2dguispriteresolutionpreview

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

alt text

lie.jpg (217.2 kB)
buildstatus.jpg (212.4 kB)
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by kristercollin · Sep 20, 2012 at 07:35 AM

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.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
2

Answer by Shrandis · Sep 20, 2012 at 01:38 PM

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.

Problem

GameView


gameview1.png (8.4 kB)
gameview2.png (8.3 kB)
Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image user5200 · Sep 20, 2012 at 08:44 PM 0
Share

Hi Shrandis,

Thanks for taking the time to do screenshots. I have attached a few screenshots myself. In comparison, It seems like $$anonymous$$e does not have gray on the top and bottom. How would I achieve that? I have already set the preview resolution to (Standalone) 1280 x 768 which is the target resolution. Anything besides this just makes it smaller.

avatar image Shrandis · Sep 20, 2012 at 08:58 PM 1
Share

You have grey areas on the top in your first screenshot. You need to make sure both the top and bottom have at least some grey (so you know the window's resolution is correct) Notice how the resolution is the same 960x600 in both of my screenshots, but in the first one, the window is resized to be very small, so the actual game window shrinked (ins$$anonymous$$d of being cropped) while still having the same aspect ratio.

Honestly it is such a strange solution to a strange problem that I'm having a hard time explaining it properly.

avatar image user5200 · Sep 21, 2012 at 07:33 PM 0
Share

Since I am working on a laptop, could it be that my laptop resolution is not big enough to support a unity preview pane with 1280 x 768 resolution? $$anonymous$$y native screen resolution is 1366 x 768 though so it shouldn't be a problem?

Ugh, this problem is really stressing me out now :(. Thanks for the input though.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

11 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to scale all sprites, gui buttons, texts, images, 3d objects proportional to the screen height 1 Answer

Adjust overlay position for different resolutions 0 Answers

[Button with animator] vs. [Sprite with mousedetection] 0 Answers

Why is my sprite not the original resolution? 2 Answers

Sprite Editor : how to use Sprites created by SpriteEditor via script ( not via inspector ) 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges