ViveSoftware / ViveInputUtility-Unity

A toolkit that helps developing/prototyping VR apps.
http://u3d.as/uF7
Other
352 stars 82 forks source link

Vive Focus Plus - error in any demo - Unity #169

Closed alamboley closed 3 years ago

alamboley commented 4 years ago

I use Wave SDK 3.1.6 and Unity 2019.2.21f1.

When running any samples, I've this error (I grab it from the Unity console with remote on):

[Error] <i>AndroidPlayer(HTC_Vive_Focus_Plus@192.168.1.34)</i> NullReferenceException: Object reference not set to an instance of an object
  at WaveVR_ButtonList.ToEButtons (System.Collections.Generic.List`1[T] eList) [0x00033] in /Users/aymeric/Documents/Workspace/Unity/2020/Enedis-VR-Attention-Marche/Assets/WaveVR/Scripts/WaveVR_ButtonList.cs:47 
  at WaveVR_ButtonList.createHmdRequestAttributes () [0x0000d] in /Users/aymeric/Documents/Workspace/Unity/2020/Enedis-VR-Attention-Marche/Assets/WaveVR/Scripts/WaveVR_ButtonList.cs:241 
  at WaveVR_ButtonList.ResetInputRequest (WaveVR_Controller+EDeviceType device) [0x00030] in /Users/aymeric/Documents/Workspace/Unity/2020/Enedis-VR-Attention-Marche/Assets/WaveVR/Scripts/WaveVR_ButtonList.cs:388 
  at WaveVR_ButtonList.ResetAllInputRequest () [0x0000d] in /Users/aymeric/Documents/Workspace/Unity/2020/Enedis-VR-Attention-Marche/Assets/WaveVR/Scripts/WaveVR_ButtonList.cs:433 
  at WaveVR_ButtonList.Start () [0x0000d] in /Users/aymeric/Documents/Workspace/Unity/2020/Enedis-VR-Attention-Marche/Assets/WaveVR/Scripts/WaveVR_ButtonList.cs:120 

(Filename: /Users/aymeric/Documents/Workspace/Unity/2020/Enedis-VR-Attention-Marche/Assets/WaveVR/Scripts/WaveVR_ButtonList.cs Line: 47)

If I change for (int i = 0; i < eList.Count; i++) to for (int i = 0; i < eList?.Count; i++) no more error, but I can't teleport for example anymore.

chengnay commented 4 years ago

@alamboley May I know which sample scene you are referring to? Wave SDK or VIU? I just tried VIU's example scene (UGUI and Teleport), both works fine.

alamboley commented 4 years ago

Hi @chengnay thanks for the update. It's VIU samples scenes. Having Development Build and Script Debugging ticked on, give me this error.

chengnay commented 4 years ago

I just ticked both, and Teleport scene still works fine. What else did I miss?

chengnay commented 4 years ago

What else you have imported in your project? VIU (latest version?)? Wave SDK?

alamboley commented 4 years ago

Yes I use Wave SDK 3.1.6 and latest VIU release.

The scenes work fine: I can trigger / drag and drop / teleport, but they trigger this error in Unity console.

chengnay commented 4 years ago

How can I do "I grab it from the Unity console with remote on"?? When does the error occur? Whenever you press any button? Or just once when you enter the scene?

I use "adb logcat -s Unity ActivityManager PackageManager dalvikvm DEBUG" But I couldn't see the error log.

alamboley commented 4 years ago

Does this help? I added Full Log (Developer Mode Only) in the option

Capture d’écran 2020-03-25 à 11 07 46
chengnay commented 4 years ago

Could I clarify the reproduce steps,

  1. Build apk with Development Build and Script Debugging ticked
  2. Play apk on Focus plus
  3. Play scene on Unity Editor
  4. Error log will appear?

In step 3, will Unity ask for Android device? I tested on Windows 10 PC, I couldn't connect with Focus plus.

alamboley commented 4 years ago
  1. Be sure Unity console is connected to HTC Vive Focus, you can change the target.
  2. Build and run apk with Development Build and Script Debugging ticked.
  3. After scene launch on focus and a basic interaction with the scene, remove the headset and check Unity console, you should have the error.

Notice that you don't need at all to play scene in Unity Editor, it may just remove any previous log.

chengnay commented 4 years ago

@alamboley After cowork with WaveSDK RD, I will give you a temporary fix. This fix will be included in next WaveSDK release.

In WaveVR_ButtonList.cs, line 83, image

Add new to HmdButtons, DominantButtons and NonDominantButtons.

Let me know if you still have issue, thanks!

alamboley commented 4 years ago

Thanks @chengnay for the code update. Now I don't have any errors but unfortunately teleport / trigger don't work anymore. Also I can't see when something is pressed/touched on the virtual controller.

chengnay commented 4 years ago

I will check with WaveSDK RD and get back to you ASAP.

chengnay commented 4 years ago

@alamboley Could you try not to use Unity remote? WaveSDK RD will need more time to find the root cause.

Note: This issue will still exist even if you unchecked Development Build & Script Debugging. You might need to create a new project.

UPDATE: Another temporary fix in VIU, In Assets\HTC.UnityPlugin\VRModule\Modules\WaveVRModule.cs, line 306, comment these lines as shown in the image below. image

Above temporary fix will cause no input effect on controller model.

alamboley commented 4 years ago

Hi @chengnay I don't use Unity remote : it's just the Unity console which is in remote mode.

If I comment those lines, I've the same problem than previously: Now I don't have any errors but unfortunately teleport / trigger don't work anymore. Also I can't see when something is pressed/touched on the virtual controller.

chengnay commented 4 years ago

It seems your result is different from mine, I can still teleport and trigger. Just I can't see when something is pressed/touched on the virtual controller.

I am still looking into this issue, please be patient, thanks!

chengnay commented 4 years ago

@alamboley Here is the solution to your issue. image

Please also include the solution to WaveVR_ButtonList.cs. Let me know if you still have issue, thanks!

alamboley commented 4 years ago

@chengnay thanks for the update. Could you provide me the code in plain text? Images aren't programmer friendly moreover with the #if statement I don't have any completion.

alamboley commented 4 years ago

hi @chengnay I added your fix, no more error and controllers work fine! Thanks :)

chengnay commented 4 years ago

@chengnay thanks for the update. Could you provide me the code in plain text? Images aren't programmer friendly moreover with the #if statement I don't have any completion.

Sorry about that! It is because when I pasted the code here in plain text, some of the code will not show properly, such as < WaveVR_ButtonList >.

Glad to hear that your issue is resolved. Cheers!