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
4
Question by Mat Brummitt · Sep 09, 2010 at 07:53 PM · iphonelightu3dxtsensor

Unity iPhone - Do we get access to the iPhone's light sensor?

Do we get access to the light sensor information? I would like to know when a user has the phone pressed flat against his/her face or another surface.

Thanks

Mat

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

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by qJake · Sep 09, 2010 at 07:56 PM

I'm no Apple developer, so this is my guess, but from what I've read, it's not even accessible from Xcode, so my guess would be no. Even if it were available natively, you would still need to write an Xcode plugin for Unity to be able to handle that event (which requires Unity Pro).

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 qJake · Sep 10, 2010 at 02:24 AM 0
Share

And by the way, there are actually two sensors on the top of the iPhone - one is a photosensor that detects brightness conditions for auto-screen dim$$anonymous$$g, and the other is a simple proximity sensor that detects if an object is held close to the top of the phone (like your ear when you're in a call).

avatar image ABerlemont · Sep 24, 2019 at 01:09 PM 0
Share

Does anyone know if it is still not accessible in Unity 2019 ? I wierdly can't find much info about that subject.

avatar image
1

Answer by u3dxt · Jan 03, 2014 at 10:47 PM

Yes, it is one of the features of our iOS Unity plugin. We expose this functionality via the UIDevice class.

 UIDevice device = UIDevice.CurrentDevice();
 device.proximityMonitoringEnabled = true; // need to enable this first

then you can just read device.proximityState to check if the user is close to the sensor. Or you can also monitor the UIDevice.UIDeviceProximityStateDidChangeNotification event to get a notified when the sensor state changes.

Comment
Add comment · Show 4 · 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 ina · Feb 06, 2014 at 05:26 AM 0
Share

there is a proximity sensor on iphone?

avatar image u3dxt · Feb 06, 2014 at 06:21 AM 0
Share

@ina, yeah. you know how when you answer a phone call the phone screen dims as you bring it closer to your face? it senses that using the proximity sensor. now you can use it for your unity games. heh.

avatar image MoradGM · Feb 25, 2014 at 11:42 PM 0
Share

Woah, that's awesome.

avatar image Thanitsak · Jan 14, 2017 at 10:11 AM 0
Share

Could you please help me, I already downloaded iOS Unity plugin, and still can't use UIDevice device = UIDevice.CurrentDevice(); device.proximity$$anonymous$$onitoringEnabled = true; Thank you in advance.

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

How to turn on camera light (make a flashlight) on iPhone/iPad? 2 Answers

How to turn on camera light on iPhone? 0 Answers

A node in a childnode? 1 Answer

U3DXT iOS plugin proximity sensor causing screen to go black? 0 Answers

Unity Penelope Tutorial and iPhone 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