• 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
Question by mochatony · Oct 10, 2013 at 02:34 AM · iphoneipad

Check is iphone or ipad

I know this question has been ask before and one way of doing this is checking of iphone generation as such:

 // Check is Ipad
 if( iPhone.generation == iPhoneGeneration.iPadUnknown ||
     iPhone.generation == iPhoneGeneration.iPad1Gen  ||
     iPhone.generation == iPhoneGeneration.iPad2Gen  ||
     iPhone.generation == iPhoneGeneration.iPad3Gen  ||
     iPhone.generation == iPhoneGeneration.iPad4Gen  ||
     iPhone.generation == iPhoneGeneration.iPadMini1Gen)
 {
     // bla bla
 }

However, as years goes by you have to continuously add in the type of ipad device in the list and when you have plenty of old apps to updates.

My question would be is there simpler solution just to tell this is an ipad?

Comment
cregox
alimoeeny

People who like this

2 Show 0
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

4 Replies

· Add your reply
  • Sort: 
avatar image
Best Answer

Answer by mochatony · Oct 10, 2013 at 04:46 AM

Thanks for the answer guys. I found something like this:

 if((iPhone.generation.ToString()).IndexOf("iPad") > -1){
   //bla bla
 }

Tested, I believe this would work.

Comment
abi-kr01
Barrett-Fox
AbgaryanFX
efge
Orbonis
taxvi
siddharth3322
sreejit_730
D3m0n
Big-Ed
DTFun

People who like this

11 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 siddharth3322 · Apr 22, 2015 at 01:17 PM 0
Share

Thanks man it helped me a lot....

avatar image Zszen-John · Oct 27, 2016 at 01:30 PM 1
Share

using UnityEngine.iOS;

if((Device.generation.ToString()).IndexOf("iPad") > -1){ //bla bla bla }

avatar image KirillKuzyk · Mar 16, 2018 at 06:56 AM 0
Share

Please be cautious using this method and don't rely on it for anything critical. When new generation of devices are out, old version of unity will not detect them correctly.

Prefer checking screen size instead.

avatar image

Answer by efge · May 23, 2015 at 09:44 PM

Update for Unity 5:

 SystemInfo.deviceModel.Contains("iPad")




Comment
Alec-Slayden
ermedian
D3m0n
Sethers
Mukikaizoku
alimoeeny
voporak5
viszkoktamas
danilocjr
TractGames

People who like this

10 Show 0 · 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

Answer by Eric5h5 · Oct 10, 2013 at 03:06 AM

Use Screen.dpi along with the screen resolution, which will enable you to get the physical size of the screen. You can assume anything smaller than 7 inches is a phone.

Comment
yashpal
cregox

People who like this

2 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 cregox · Nov 15, 2014 at 10:42 AM 0
Share

I vow for testing screen dpi or size, which is the primary reason behind checking for iPad.

avatar image

Answer by $$anonymous$$ · Oct 10, 2013 at 03:51 AM

I've been using a 6" threshold for the screen diagonal as a phone/tablet differentiator applied when

 SystemInfo.deviceType == DeviceType.Handheld.

You can calculate the length of the screen diagonal in inches by using Screen.width, Screen.height, Screen.dpi and the Pythagorean Theorem.

Now there are these things called "fablets", so you may want to adjust the threshold depending on whether you want "fablets" to be classified as phones or tablets.

Comment
cregox
Orbonis

People who like this

2 Show 0 · 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.

Update about the future of Unity Answers

Unity Answers content will be migrated to a new Community platform and we are aiming to launch a public beta later in June. Please note, we are aiming to set Unity Answers to read-only mode on the 31st of May in order to prepare for the final data migration.

For more information, please read our full announcement.

Follow this Question

Answers Answers and Comments

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

Related Questions

question regarding buying from asset store 3 Answers

How do I destroy things properly to free up memory? (iOS) 3 Answers

Iphone 4 build is crashing. 0 Answers

iPhone vs iPad for testing iOS apps 1 Answer

Weird iPad render bug 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