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 imnickb · Apr 14, 2013 at 08:14 PM · uiiosresolutiondevicedimensions

Identifying iphone resolution isn't working for all devices

I'm working on a mac but I'm developing for iOS. I've got the iOS add on and I'm switching the resolution in the resolution drop down box. I'm just trying to move a UI element to look good on all resolutions. I've cased out the resolutions in script and for some resolutions it's working but other resolutions are not returning the correct dimensions. Any help would be appreciated!

I'm casing things out according to height and width instead of using the device type since the device type doesn't return what I want when using the editor. Let me know if I'm way off base here. Thanks!

 function Start ()
 {
     //iPhone & iPhone3G & iPhone3GS - Wide
     if (Screen.width == 480 && Screen.height == 320)
     {
         print("iPhone & iPhone3G & iPhone3GS - Wide" + Screen.height);
         transform.position = Vector3(-1.45, .8, 0);
     }
     //iPhone4 & iPhone4S - Wide
     if (Screen.width == 960 && Screen.height == 640)
     {
         print("iPhone4 & iPhone4S - Wide" + Screen.height);
         transform.position = Vector3(-1.45, .8, 0);
     }
     //iPhone 5 - Wide
     if (Screen.width == 1136 && Screen.height == 640)
     {
         print("iPhone5 - Wide" + Screen.height);
         transform.position = Vector3(-1.3, .8, 0);
     }
     //iPad & iPad2 & iPad mini - Wide
     if (Screen.width == 1024 && Screen.height == 768)
     {
         print("iPad & iPad2 & iPad mini - Wide" + Screen.height);
         transform.position = Vector3(-1.3, .8, 0);
     }
     //iPad3 - Wide
     if (Screen.width == 2048 && Screen.height == 1536)
     {
         print("iPad3 - Wide" + Screen.height);
         transform.position = Vector3(-1.75, .8, 0);
     }
     else
     {
         print(Screen.height);    
         transform.position = Vector3(-1.45, .8, 0);
     }
 }
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
0

Answer by corrivai · Oct 08, 2018 at 07:56 AM

Ok, the thread is very old, but the solution is:

 /iPhone & iPhone3G & iPhone3GS - Wide
      if (Screen.width == 480 && Screen.height == 320)
      {
          print("iPhone & iPhone3G & iPhone3GS - Wide" + Screen.height);
          transform.position = Vector3(-1.45, .8, 0);
      }
      else if (Screen.width == 960 && Screen.height == 640) //iPhone4 & iPhone4S - Wide
      {
          print("iPhone4 & iPhone4S - Wide" + Screen.height);
          transform.position = Vector3(-1.45, .8, 0);
      }

:)

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

12 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

Related Questions

Unity UI: Scaling a 16:9 setup down to4:3 1 Answer

Mobile device screen resolution 1 Answer

Use different sprites in new Unity UI for SD vs HD 2 Answers

Duplication of the scenes for different resolutions ? 1 Answer

UI button behaves wrong on iPad 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