Lofelt / NiceVibrations

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

HapticController.outputLevel setting while clip is not loaded raises a native java error.(Android) #33

Open kekchpek opened 1 year ago

kekchpek commented 1 year ago

Bug report

Checklist

Environment

Apk built with Unity 2021.3.18f1 App runs on Pixel a6, Samsung Galaxy S23 and few other devices.

Goals

Set vibrations outputLevel to some value and have no errors in the log.

Steps to Reproduce

Execute next code right after application starts:

var inited = HapticController.Init();
HapticController.outputLevel = 0.2f;
Debug.Log($"Initialization result: {inited}"); // this logs true value, so initialization is successfull

Expected behavior

No errors and outputLevel set.

Observed behavior

Looks like the property is set correctly, but there is an error in log:

Error: java.lang.RuntimeException: Unable to set amplitude multiplication, no clip loaded.
java.lang.RuntimeException: Unable to set amplitude multiplication, no clip loaded.
 at com.lofelt.haptics.LofeltHaptics.setAmplitudeMultiplication(Native Method)
 at com.lofelt.haptics.LofeltHaptics.setAmplitudeMultiplication(LofeltHaptics.java:409)
 at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
 at com.unity3d.player.UnityPlayer.access$300(Unknown Source:0)
 at com.unity3d.player.UnityPlayer$e$1.handleMessage(Unknown Source:95)
 at android.os.Handler.dispatchMessage(Handler.java:102)
 at android.os.Looper.loopOnce(Looper.java:201)
 at android.os.Looper.loop(Looper.java:288)
 at com.unity3d.player.UnityPlayer$e.run(Unknown Source:20)

Code Samples & Details

This is not a critical issue, but if you use any crashlytics this issue makes your life a bit harder.