Jump to content

[Unity3D] Get Proximity Sensor Status


Fangh

Recommended Posts

  • 4 months later...
  • 2 years later...

Sample code:

        public static bool IsUserPresence()
        {
#if UNITY_ANDROID
            if (ProximitySensor.current != null)
            {
                if (!ProximitySensor.current.IsActuated())
                    InputSystem.EnableDevice(ProximitySensor.current);

                return ProximitySensor.current.distance.ReadValue() < 1; // near p-sensor < 1cm
            }
            else
            {
                return false;
            }
#else
            return true;
#endif
        }
 

Link to comment
Share on other sites

  • 1 year later...

Hello,

Just a little update to say that the sample code doesn't seem to work with the latest version of the WaveXRPlugin, however the asset shared by @thylaxene (https://assetstore.unity.com/packages/tools/integration/pa-proximity-25685) still works perfectly.

Also I found this post by looking for a replacement for CommonUsages.UserPresence since it's not supported anymore since the release 5.3.0 of Wave XR Plugin and I wondered why it's no longer supported ? Was it replaced by something else I didn't found ?

Thanks,

 

Link to comment
Share on other sites

  • 2 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...