microsoft / MixedRealityToolkit-Unity

This repository is for the legacy Mixed Reality Toolkit (MRTK) v2. For the latest version of the MRTK please visit https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity
https://aka.ms/mrtkdocs
MIT License
6.01k stars 2.12k forks source link

_PressIntensity was not found. Please provide a valid material property name. Oculus Quest Build. #10388

Closed iivvaannxx closed 2 years ago

iivvaannxx commented 2 years ago

This is the first time I write an issue so forgive if I don't explain myself well.

Describe the bug

When I build my application using the Android Platform to an Oculus Quest device and run it, I only get a black screen. Using the Android Logcat I saw that there's an error with a Material Property. This is the trace:

21/12/19 13:58:17.915 6011 6034 Error Unity Exception: The property _PressIntensity for reacting to pinch strength was not found please provide a valid material property name

2021/12/19 13:58:17.915 6011 6034 Error Unity Exception: The property _PressIntensity for reacting to pinch strength was not found please provide a valid material property name
2021/12/19 13:58:17.915 6011 6034 Error Unity   at Microsoft.MixedReality.Toolkit.Input.RiggedHandVisualizer.Microsoft.MixedReality.Toolkit.Input.IMixedRealityHandJointHandler.OnHandJointsUpdated (Microsoft.MixedReality.Toolkit.Input.InputEventData`1[T] eventData) [0x00583] in D:\Documents\Unity Development\Projects\Ictus Project\Library\PackageCache\com.microsoft.mixedreality.toolkit.foundation@f668f6c6655c-1631793666009\SDK\Features\UX\Scripts\RiggedHandVisualizer\RiggedHandVisualizer.cs:470 
2021/12/19 13:58:17.915 6011 6034 Error Unity   at Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSystem+<>c.<.cctor>b__244_44 (Microsoft.MixedReality.Toolkit.Input.IMixedRealityHandJointHandler handler, UnityEngine.EventSystems.BaseEventData eventData) [0x00008] in D:\Documents\Unity Development\Projects\Ictus Project\Library\PackageCache\com.microsoft.mixedreality.toolkit.foundation@f668f6c6655c-1631793666009\Services\InputSystem\MixedRealityInputSystem.cs:1969 
2021/12/19 13:58:17.915 6011 6034 Error Unity   at Mic

I can't follow the error because the trace cuts on that line, and nothing else gets logged (just this error, continuously), I tried multiple things but I just can't get the full error message and the full stack trace...

The build completes without errors, and I get my APK without any problems. But when I run it, I get this.

To reproduce

I actually do not know how to reproduce it because until not long ago the build worked without any problems. I don't know if it's my fault or if is anything related to the Unity version (I had to switch to a newer one a few days ago).

Screenshots

image

Setup

Target platform

Additional context

In the editor, through Oculus Link, everything works. I tried to delete and rebuild the Package Cache by deleting the Library folder but that did not solve the problem.

I also tried to build a standalone Windows Build and test it through Oculus Link, then everything works fine, so it seems that is only a problem when I try to build to the Oculus device. By the way, not sure if it helps but I am using URP.

keveleigh commented 2 years ago

Huh, strange! @RogPodge, have you ever seen this? @iivvaannxx, can you please confirm which shader the RiggedHandVisualizer is using? You should be able to check the prefab under Controllers > Controller Visualization Settings, then looking in either Global Left/Right Hand Visualizer or a controller-specific override for Oculus.

RogPodge commented 2 years ago

I haven't seen this issue specificially, but I think it's related to the material we use for the rigged hands not compiling properly onto Android when using URP.

If you can't get the shader to work, you can comment these lines to work around the exception for now https://github.com/microsoft/MixedRealityToolkit-Unity/blob/f06939ebd47e1c200c83dcdc3e5d3928c90459cd/Assets/MRTK/SDK/Features/UX/Scripts/RiggedHandVisualizer/RiggedHandVisualizer.cs#L464-L471

iivvaannxx commented 2 years ago

Okay, so first of all, @keveleigh I looked into the Rigged Hand Visualizer prefab for both hands, out of play mode and also at runtime (during play mode, to make sure the material it's not somehow updated) and in both cases I saw the same material, called HandMeshOutline, which has the shader RimOutline. There wasn't any Oculus specific override.

Then, @RogPodge I did what you said and commented that block, then the application does not throw that error but instead I got this:

image

I don't know if it's related to this issue or to another but I thought I should mention it. While testing the app I still can't see anything else than a black screen, due to this another error I guess, but I noticed that the game is actually running, because I have some audio which is played when some objects are hovered with the rays (of either the hands or the head).

When I randomly move my head, I don't see anything, but I can hear sometimes the interaction sound playing. Don't know what can be happening but I certainly would appreciate a little help.

RogPodge commented 2 years ago

I recall that exception being a non-blocking one, thought the black screen issue is something I am not familiar with.

https://docs.microsoft.com/en-us/windows/mixed-reality/mrtk-unity/supported-devices/oculus-quest-mrtk?view=mrtkunity-2021-05

Do you have the same issues following these instructions and deploying to Unity 2020? I don't think we've done much development on Unity 2021 yet with MRTK v2.

iivvaannxx commented 2 years ago

@RogPodge I will take a look and give it a try. It may take a little because I can't downgrade to Unity 2020 easily as the project is not particularly little. Besides I am a little busy these days.

I will reply and tell as soon as I can, thanks!

iivvaannxx commented 2 years ago

@RogPodge Okay, so I apologize for such a late reply but I was too busy with a lot of other stuff. Today I tried to migrate the project to Unity 2020. It did not go quite well.

First I got a bunch of scripting errors because on the project I was using C# 9 features (I think) or at least features that are supported on 2021 but not on 2020, it took a little to fix. After I managed to get everything working I tried to run the scene on both editor and build, here's the problem now:

On the editor i keep getting this annoying error all the time:

The list of [SerializeReference] objects being deserialized is from a more recent version of Unity. This is not supported and objects will be skipped.
UnityEditor.AssetDatabase:LoadAssetAtPath<UnityEngine.ScriptableObject> (string)
Microsoft.MixedReality.Toolkit.Editor.ScriptableObjectExtensions:GetAllInstances<UnityEngine.ScriptableObject> () (at Library/PackageCache/com.microsoft.mixedreality.toolkit.foundation@ad1fef596cc6-1642786332592/Core/Extensions/EditorClassExtensions/ScriptableObjectExtensions.cs:65)
Microsoft.MixedReality.Toolkit.Editor.SceneInfoUtils:RefreshSceneInfoFieldsInScriptableObjects () (at Library/PackageCache/com.microsoft.mixedreality.toolkit.foundation@ad1fef596cc6-1642786332592/Core/Inspectors/PropertyDrawers/SceneInfoUtils.cs:298)
Microsoft.MixedReality.Toolkit.Editor.SceneInfoUtils:InitializeOnLoad () (at Library/PackageCache/com.microsoft.mixedreality.toolkit.foundation@ad1fef596cc6-1642786332592/Core/Inspectors/PropertyDrawers/SceneInfoUtils.cs:231)
UnityEditor.EditorAssemblies:ProcessInitializeOnLoadMethodAttributes ()

It does not prevent me entering to Play Mode. If I try to execute, sometimes I get this:

NullReferenceException: Object reference not set to an instance of an object
Microsoft.MixedReality.Toolkit.XRSDK.Oculus.Input.OculusXRSDKDeviceManager.GetOrAddController (UnityEngine.XR.InputDevice inputDevice) (at Library/PackageCache/com.microsoft.mixedreality.toolkit.foundation@ad1fef596cc6-1642786332592/Providers/Oculus/XRSDK/OculusXRSDKDeviceManager.cs:109)
Microsoft.MixedReality.Toolkit.XRSDK.Input.XRSDKDeviceManager.Update () (at Library/PackageCache/com.microsoft.mixedreality.toolkit.foundation@ad1fef596cc6-1642786332592/Providers/XRSDK/XRSDKDeviceManager.cs:114)
Microsoft.MixedReality.Toolkit.XRSDK.Oculus.Input.OculusXRSDKDeviceManager.Update () (at Library/PackageCache/com.microsoft.mixedreality.toolkit.foundation@ad1fef596cc6-1642786332592/Providers/Oculus/XRSDK/OculusXRSDKDeviceManager.cs:221)
Microsoft.MixedReality.Toolkit.BaseDataProviderAccessCoreSystem.Update () (at Library/PackageCache/com.microsoft.mixedreality.toolkit.foundation@ad1fef596cc6-1642786332592/Core/Services/BaseDataProviderAccessCoreSystem.cs:51)
Microsoft.MixedReality.Toolkit.MixedRealityToolkit+<>c.<UpdateAllServices>b__72_0 (Microsoft.MixedReality.Toolkit.IMixedRealityService service) (at Library/PackageCache/com.microsoft.mixedreality.toolkit.foundation@ad1fef596cc6-1642786332592/Core/Services/MixedRealityToolkit.cs:1054)
Microsoft.MixedReality.Toolkit.MixedRealityToolkit.ExecuteOnAllServicesInOrder (System.Action`1[T] execute) (at Library/PackageCache/com.microsoft.mixedreality.toolkit.foundation@ad1fef596cc6-1642786332592/Core/Services/MixedRealityToolkit.cs:1145)
Microsoft.MixedReality.Toolkit.MixedRealityToolkit.UpdateAllServices () (at Library/PackageCache/com.microsoft.mixedreality.toolkit.foundation@ad1fef596cc6-1642786332592/Core/Services/MixedRealityToolkit.cs:1054)
Microsoft.MixedReality.Toolkit.MixedRealityToolkit.Update () (at Library/PackageCache/com.microsoft.mixedreality.toolkit.foundation@ad1fef596cc6-1642786332592/Core/Services/MixedRealityToolkit.cs:727)

But yet everything works fine and there aren't any problems (same as on Unity 2021). Regarding to the build, I am not even able to build, I tried like 4 times, and it continuously keeps printing me this two errors:

Library\PackageCache\com.microsoft.mixedreality.toolkit.foundation@ad1fef596cc6-1642786332592\SDK\Experimental\SpatialAwareness\SurfaceMeshesToPlanes.cs(13,55): error CS0234: The type or namespace name 'Processing' does not exist in the namespace 'Microsoft.MixedReality.Toolkit.SpatialAwareness' (are you missing an assembly reference?)

Library\PackageCache\com.microsoft.mixedreality.toolkit.foundation@ad1fef596cc6-1642786332592\SDK\Experimental\SpatialAwareness\SurfaceMeshesToPlanes.cs(397,59): error CS0246: The type or namespace name 'BoundedPlane' could not be found (are you missing a using directive or an assembly reference?)

In order to make it clear, to migrate the project I followed these steps:

1. Create a new project with Unity 2020.3.24f1
2. Add the necessary packages and configure it.
3. Copy the Assets, ProjectSettings and UserSettings from the previous one (except for the ProjectVersion.txt)
4. Run, let everything to import, fix the scripting errors.
5. Test on editor and on build.

If you can help me get over these errors, then I could try to build again and see if the black screen disappears. If that doesn't help solve the issue neither, I would assume that is a problem with my Oculus Device and not with the MRTK. Thanks!

steven-cerebralfix commented 2 years ago

If it is helpful I also get the error: Error Unity Exception: The property _PressIntensity for reacting to pinch strength was not found please provide a valid material property name It occurs when I copy the RiggedHandLeft prefab into my project and use it in MixedRealityToolkit->Input->Controllers->Global Left Hand Visualizer. I also unassign the override model in Microsoft Articulated Hand Left Hand so that it uses the global hand.

I've also assigned the "Hand Material" to MTRK_Standard_Black. This is the cause of my problems as I'm just using the model for occlusion rather than supporting press. It doesn't feel like the Exception is necessary, perhaps just a warning?

RogPodge commented 2 years ago

I agree reassigning the material is causing the errors. I think we may call into that "_PressIntensity" property in code, even though in cases like this is optional.

Sorry for the late response on our end too, I'll try to look into this and get a fix out by our next pre-3.0 release