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
1
Question by elderhorst · Oct 16, 2014 at 07:44 PM · androidscreen.height

On Android device Screen.height is returning an incorrect value

In my scene I am trying to center an object and make it's size the height and width of the screen. However when I deploy to a Nexus 5 device that has a resolution of 1920 x 1080 the height and width that is being returned with Screen.height and Screen.width is 1776 x 1080. I've also encountered something similar on Samsung Galaxy S4 and S5 devices. (I don't have the height values that those devices are returning, but if need be I could get them.) It does display correctly on a Nexus 7 device though, so this doesn't appear to be consistent across all devices.

I'm using Unity 4.5.4 and the Nexus 5 is using Android 4.4.2.

Does anyone know of a reason as to why this could be happening?

Comment
Add comment · Show 1
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 radya · Mar 27, 2015 at 07:46 AM 0
Share

I have same issue with acer, nexus 7 2013 and nexus 10. I think a reason is undefined behavior for software bottoms in some Android versions.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Yury-Habets · Mar 27, 2015 at 08:35 AM

First of all, Screen.height returns the window height, not the hardware resolution: http://docs.unity3d.com/ScriptReference/Screen-height.html

Support for immersive fullscreen mode (Android 4.4+) was added in Unity 5. In Unity 4, you got screen height minus the button bar height, so the results looks correct for me. In Unity 5, it returns 1280x768 for my Nexus 4, which also looks correct.

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

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Screen.width and Screen.height sometimes flipped for Android 1 Answer

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

Android orientation issue 1 Answer

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

Screen.width & height not updated after screen rotation 1 Answer


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