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 Guardian2300 · May 13, 2013 at 08:11 PM · screen resolutionscreen.widthscreen.height

Screen.height and Screen.width Issues

I have several type of windows that use Screen.width and Screen.height. Some reason the Width of the Screen keeps going off the screen by a couple hundred pixels. I was wondering if this would be a program fault or engine fault.

 ChatWindowSize  = new Rect(0,Screen.height/2,Screen.width/3,Screen.height);

but Screen.height just goes beyond my window space and have to subtract about 300 to get it back on to screen. Same goes for Screen.width. I have tryed building and running it at a higher resolution. Still the window goes off the screen.

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

1 Reply

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by robertbu · May 13, 2013 at 08:12 PM

Take a close look at the parameter of a Rect(). They are (x,y,width,height). So you are placing your window half way down the screen with a full screen of height, so the bottom 1/2 will be cutoff.

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 Guardian2300 · May 13, 2013 at 09:04 PM 0
Share

So if I wanted to create a window that can be resized from a different resolutions. How could I fix this problem or would I have to just subtract or divide the window size by screen size

avatar image robertbu · May 14, 2013 at 06:29 AM 0
Share

I'm not sure what you want to do. Given your code above, just divide the height by 2:

 ChatWindowSize  = new Rect(0,Screen.height/2,Screen.width/3,Screen.height/2);
avatar image Guardian2300 · May 19, 2013 at 07:31 AM 0
Share

I was trying to make it so the window would stay on screen and not off it at all times which I Figured out how to do. So if your window starting position isn't at 0 for example the Screen.height/2, ins$$anonymous$$d of where in the 2nd height position you subtract the difference so its Screen.height - Screen.height/2 which should bring the window back to the size of your screen. Hope this is making sense

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

14 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 avatar image avatar image avatar image

Related Questions

Screen.width/Screen.height not working with multiple resolutions 0 Answers

how can i divide screen to x & y axes for different resolutions 1 Answer

Do screen.width and screen.height get updated depending on screen orientation on Android? 1 Answer

Android screen orientation: why am I getting wrong screen size values? 1 Answer

Can you tell unity to resize the Game window by a button press? 2 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