• 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
2
Question by Potapczuk · Jan 03, 2011 at 12:52 AM · androidscreen

How to get the Screen Size

Im developing a Android Game, and to adjust my camera, i need to check the size of the screen of my user, the actual inch of the display, and not the resolution. Because there are devices with the same display size and different resolutions.

In Android development this is fixed using the DP unit.

Density-independent Pixels - an abstract unit that is based on the physical density of the screen. These units are relative to a 160 dpi screen, so one dp is one pixel on a 160 dpi screen. The ratio of dp-to-pixel will change with the screen density, but not necessarily in direct proportion.

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

3 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by Bampf · Jan 03, 2011 at 02:18 AM

I asked this question a while back for iOS: http://answers.unity3d.com/questions/23490/is-there-a-way-to-detect-a-retina-display

Currently (as of Unity 3.1) there does not seem to be a way to do it- the iOS workaround is simply to enumerate known devices that have a retina display.

I do not have access to the Android version though, and given the proliferation of Android devices I would expect such a setting to be even more important So perhaps there's a solution for Android I don't know about.

Comment
Add comment · Show 2 · 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 Potapczuk · Jan 03, 2011 at 03:16 AM 0
Share

I found this: http://unity3d.com/support/documentation/ScriptReference/iPhoneSettings.html

$$anonymous$$aybe it can help you, checking by the model of the device.

avatar image Bampf · Jan 03, 2011 at 08:41 PM 0
Share

Yep, that's the answer I keep getting, but it potentially breaks when new models come out. So I'd prefer to know the actual DPI (which would also help you with your Android situation) or have a retina display indicator (iOS only.)

avatar image
0

Answer by cfloutier · Sep 27, 2011 at 03:28 PM

I've ot the same trouble, i'll try to make a direct call to android api.

I'll post the solution here if i find it

Comment
Add comment · Show 1 · 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 taar1 · Jan 09, 2012 at 12:00 PM 0
Share

Could you find a solution for that? I am currently having the same problem.

avatar image
0

Answer by CoalCzar · Jun 18, 2014 at 04:25 PM

Don't know when this was added, but this might help you:

Screen DPI

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Android screen size - How to? 1 Answer

android platform 0 Answers

Why is the Official Unity Splash Screen not stretching on Android? 2 Answers

android screen problem 2 Answers

Screen dims when its not supposed to 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