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 Safforn · Oct 30, 2014 at 09:37 AM · iosdetectionplatformipad

Detecting iPad with C#

Hello,

I have a mobile game with a GUI HUD. I use some calculations using screen.width and screen.height. This works fine on Android, but because iOS devices set the screen.height differently my HUD is all messed up. I want to fix this using a simple if statement:

  if (Application.platform == RuntimePlatform.Android)

and

 if (Application.platform == RuntimePlatform.IPhonePlayer)

But RuntimePlatform only has a iPhonePlayer. Because I am working with an iPad this doesn't seem to work.

Do any of you guys (and girls) know how I can detect iOS of all kinds?

Thanks,

Nils

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 Xitech_ · Oct 30, 2014 at 09:58 AM 0
Share

I'd like to re$$anonymous$$d you to ACCEPT THE ANSWERS if it helped you. Seeing your history you did not do it :)

4 Replies

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

Answer by Xitech_ · Oct 30, 2014 at 09:52 AM

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

This question has been answered here:

http://answers.unity3d.com/questions/552549/check-is-iphone-or-ipad.html

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 taxvi · Aug 12, 2015 at 01:12 PM 0
Share

if(SystemInfo.device$$anonymous$$odel.Contains("iPad").ToString().IndexOf("iPad") > -1){ //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 ins$$anonymous$$d.

avatar image
3

Answer by lateKnight9060 · Apr 19, 2016 at 12:15 PM

Actually its: if(SystemInfo.deviceModel.Contains("iPad")) { //Do Stuff here }

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 decapator · Nov 17, 2018 at 12:24 AM 0
Share

Clean and simple !

avatar image
0

Answer by SnailGirl · Mar 01, 2018 at 10:11 PM

does anyone know if there's a way of debugging these functions in unity? as in simulating opening in an ipad/iphone?

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

Answer by Silverlode · Mar 10, 2019 at 10:14 PM

 UnityEngine.iOS.Device.generation.ToString().Contains("iPad");

Would this also be acceptable and reasonably`enter code here` future-proof?

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

32 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 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

iPhone Controller Asset 0 Answers

Screen.sleepTimeout works when application runs in background on iOS (iPad) 0 Answers

Specifying a high quality background image for iPad 1 Answer

Keyboard triggered animation not showing on IOS device 0 Answers

App crash when using siri dictation to replace text on iOS 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