Detecting support for advanced haptics, by using the included DeviceCapabilities.meetsAdvancedRequirements method.
Steps to Reproduce
Set up the Nice Vibrations package on a fresh Unity project, targeting the iOS platform. Add a debug call for DeviceCapabilities.meetsAdvancedRequirements, triggering on a button press, and monitor for the console output.
Expected behavior
iPhone devices from 2017 onwards (iPhone 8 and iPhone X and newer) all support Apple's Core Haptics API and should support all advanced haptics functionality, so the meetsAdvancedRequirements check should return true.
Observed behavior
The meetsAdvancedRequirements check returns false, which is incorrect. The hasAmplitudeModulation and hasFrequencyModulation checks also incorrectly return false, though these seem to use the same check method as meetsAdvancedRequirements anyway.
Code Samples & Details
These results can be confirmed as being returned incorrect by attempting to play advanced haptics without performing those checks beforehand. Advanced haptics files will play no problem at all without falling back to basic haptics, even though the requirement checks are saying that it's not supported.
I'm only able to test on the iPhone 15 Pro and iOS 17, so I'm not sure if this affects other devices, or just the latest generation iPhones (or potentially Android devices as well).
I was checking the codebase and saw these lines.
Maybe unity returns undefined value for iphone 15+ devices. worth to print a debug log and see if it works fine.
Bug report
Checklist
Environment
Goals
Detecting support for advanced haptics, by using the included DeviceCapabilities.meetsAdvancedRequirements method.
Steps to Reproduce
Set up the Nice Vibrations package on a fresh Unity project, targeting the iOS platform. Add a debug call for DeviceCapabilities.meetsAdvancedRequirements, triggering on a button press, and monitor for the console output.
Expected behavior
iPhone devices from 2017 onwards (iPhone 8 and iPhone X and newer) all support Apple's Core Haptics API and should support all advanced haptics functionality, so the meetsAdvancedRequirements check should return true.
Observed behavior
The meetsAdvancedRequirements check returns false, which is incorrect. The hasAmplitudeModulation and hasFrequencyModulation checks also incorrectly return false, though these seem to use the same check method as meetsAdvancedRequirements anyway.
Code Samples & Details
These results can be confirmed as being returned incorrect by attempting to play advanced haptics without performing those checks beforehand. Advanced haptics files will play no problem at all without falling back to basic haptics, even though the requirement checks are saying that it's not supported.
I'm only able to test on the iPhone 15 Pro and iOS 17, so I'm not sure if this affects other devices, or just the latest generation iPhones (or potentially Android devices as well).