Lofelt / NiceVibrations

🎮 🚀 Nice Vibrations and Lofelt Studio SDK source code repository
MIT License
138 stars 17 forks source link

DeviceCapabilities.meetsAdvancedRequirements returns incorrect result on iPhone 15 Pro (possibly other devices) #36

Open william-solus opened 11 months ago

william-solus commented 11 months ago

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).

cihadturhan commented 4 weeks ago

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.

https://github.com/Lofelt/NiceVibrations/blob/5e5866386ffd51a938200299cd5d0a4851dbaa0c/interfaces/unity/NiceVibrations/Assets/NiceVibrations/Scripts/Components/DeviceCapabilities.cs#L181-L225