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.02k stars 2.12k forks source link

Shader Errors when setting up an Example project via HoloLens 2 tutorials #10114

Closed danzeeeman closed 10 months ago

danzeeeman commented 3 years ago

Describe the bug

I followed the guide here on setting up a Unity project for Hololens 2 development. I went an added the example from the Mixed Reality Toolkit Examples in the Package Manager of Unity. Most of the UI elements are throwing shader errors shown below?

image

To reproduce

Steps to reproduce the behavior:

  1. Follow Guide
  2. Open Package Manager and add all examples from Mixed Reality Toolkit Examples package
  3. Open a Scene and Hit Play
  4. UI Elements will be Pink

Expected behavior

All shaders to be included or compile correctly

Screenshots

image

Your setup (please complete the following information)

Target platform (please complete the following information)

danzeeeman commented 3 years ago

Also occurring with Unity 2020.3.14f1

MaxWang-MS commented 3 years ago

I was not able to repro with Unity 2021.1.12f1 and this problem is not known to Unity 2020.3.x as well. @keveleigh @cre8ivepark I am wondering if you have some thoughts on what is happening here? Also @danzeeeman could you share a screenshot of the unity package manager window and name some specific scenes where the issue is observed? Could you confirm that you strictly followed the tutorial and made no attempt to use URP?

danzeeeman commented 3 years ago

I did the tutorial a couple times with the same result each time.. Here is the screen shot of the Packages in Project. image

below is my manifest that was auto generated by the Mixed Reality Feature Tool

I did not attempt to use the URP.

  "dependencies": {
    "com.microsoft.azure.object-anchors.runtime": "file:MixedReality/com.microsoft.azure.object-anchors.runtime-0.12.0.tgz",
    "com.microsoft.azure.remote-rendering": "file:MixedReality/com.microsoft.azure.remote-rendering-1.0.17.tgz",
    "com.microsoft.azure.spatial-anchors-sdk.android": "file:MixedReality/com.microsoft.azure.spatial-anchors-sdk.android-2.10.2.tgz",
    "com.microsoft.azure.spatial-anchors-sdk.core": "file:MixedReality/com.microsoft.azure.spatial-anchors-sdk.core-2.10.2.tgz",
    "com.microsoft.azure.spatial-anchors-sdk.ios": "file:MixedReality/com.microsoft.azure.spatial-anchors-sdk.ios-2.10.2.tgz",
    "com.microsoft.azure.spatial-anchors-sdk.windows": "file:MixedReality/com.microsoft.azure.spatial-anchors-sdk.windows-2.10.2.tgz",
    "com.microsoft.mixedreality.input": "file:MixedReality/com.microsoft.mixedreality.input-0.9.2006.tgz",
    "com.microsoft.mixedreality.openxr": "file:MixedReality/com.microsoft.mixedreality.openxr-1.0.1.tgz",
    "com.microsoft.mixedreality.sceneunderstanding": "file:MixedReality/com.microsoft.mixedreality.sceneunderstanding-0.6.0.tgz",
    "com.microsoft.mixedreality.toolkit.examples": "file:MixedReality/com.microsoft.mixedreality.toolkit.examples-2.7.2.tgz",
    "com.microsoft.mixedreality.toolkit.extensions": "file:MixedReality/com.microsoft.mixedreality.toolkit.extensions-2.7.2.tgz",
    "com.microsoft.mixedreality.toolkit.foundation": "file:MixedReality/com.microsoft.mixedreality.toolkit.foundation-2.7.2.tgz",
    "com.microsoft.mixedreality.toolkit.gpustats": "file:MixedReality/com.microsoft.mixedreality.toolkit.gpustats-1.0.3.tgz",
    "com.microsoft.mixedreality.toolkit.micstream": "file:MixedReality/com.microsoft.mixedreality.toolkit.micstream-1.0.0.tgz",
    "com.microsoft.mixedreality.toolkit.planefinding": "file:MixedReality/com.microsoft.mixedreality.toolkit.planefinding-1.0.0.tgz",
    "com.microsoft.mixedreality.toolkit.standardassets": "file:MixedReality/com.microsoft.mixedreality.toolkit.standardassets-2.7.2.tgz",
    "com.microsoft.mixedreality.toolkit.testutilities": "file:MixedReality/com.microsoft.mixedreality.toolkit.testutilities-2.7.2.tgz",
    "com.microsoft.mixedreality.toolkit.tools": "file:MixedReality/com.microsoft.mixedreality.toolkit.tools-2.7.2.tgz",
    "com.microsoft.mixedreality.webrtc": "file:MixedReality/com.microsoft.mixedreality.webrtc-2.0.2.tgz",
    "com.microsoft.mixedreality.webrtc.samples": "file:MixedReality/com.microsoft.mixedreality.webrtc.samples-2.0.2.tgz",
    "com.microsoft.mixedreality.wlt.asa": "file:MixedReality/com.microsoft.mixedreality.wlt.asa-1.4.0.tgz",
    "com.microsoft.mixedreality.wlt.asa.samples": "file:MixedReality/com.microsoft.mixedreality.wlt.asa.samples-1.4.0.tgz",
    "com.microsoft.mixedreality.worldlockingsamples": "file:MixedReality/com.microsoft.mixedreality.worldlockingsamples-1.4.0.tgz",
    "com.microsoft.mixedreality.worldlockingtools": "file:MixedReality/com.microsoft.mixedreality.worldlockingtools-1.4.0.tgz",
    "com.microsoft.spatialaudio.spatializer.unity": "file:MixedReality/com.microsoft.spatialaudio.spatializer.unity-1.0.196.tgz",
    "com.microsoft.windows.mixedreality.dotnetwinrt": "file:MixedReality/com.microsoft.windows.mixedreality.dotnetwinrt-0.5.2009.tgz",
    "com.unity.collab-proxy": "1.5.7",
    "com.unity.ide.rider": "2.0.7",
    "com.unity.ide.visualstudio": "2.0.9",
    "com.unity.ide.vscode": "1.2.3",
    "com.unity.test-framework": "1.1.27",
    "com.unity.textmeshpro": "3.0.6",
    "com.unity.timeline": "1.4.8",
    "com.unity.toolchain.win-x86_64-linux-x86_64": "0.1.21-preview",
    "com.unity.ugui": "1.0.0",
    "com.unity.xr.openxr": "1.2.3",
    "com.unity.modules.ai": "1.0.0",
    "com.unity.modules.androidjni": "1.0.0",
    "com.unity.modules.animation": "1.0.0",
    "com.unity.modules.assetbundle": "1.0.0",
    "com.unity.modules.audio": "1.0.0",
    "com.unity.modules.cloth": "1.0.0",
    "com.unity.modules.director": "1.0.0",
    "com.unity.modules.imageconversion": "1.0.0",
    "com.unity.modules.imgui": "1.0.0",
    "com.unity.modules.jsonserialize": "1.0.0",
    "com.unity.modules.particlesystem": "1.0.0",
    "com.unity.modules.physics": "1.0.0",
    "com.unity.modules.physics2d": "1.0.0",
    "com.unity.modules.screencapture": "1.0.0",
    "com.unity.modules.terrain": "1.0.0",
    "com.unity.modules.terrainphysics": "1.0.0",
    "com.unity.modules.tilemap": "1.0.0",
    "com.unity.modules.ui": "1.0.0",
    "com.unity.modules.uielements": "1.0.0",
    "com.unity.modules.umbra": "1.0.0",
    "com.unity.modules.unityanalytics": "1.0.0",
    "com.unity.modules.unitywebrequest": "1.0.0",
    "com.unity.modules.unitywebrequestassetbundle": "1.0.0",
    "com.unity.modules.unitywebrequestaudio": "1.0.0",
    "com.unity.modules.unitywebrequesttexture": "1.0.0",
    "com.unity.modules.unitywebrequestwww": "1.0.0",
    "com.unity.modules.vehicles": "1.0.0",
    "com.unity.modules.video": "1.0.0",
    "com.unity.modules.vr": "1.0.0",
    "com.unity.modules.wind": "1.0.0",
    "com.unity.modules.xr": "1.0.0"
  }
}
keveleigh commented 3 years ago

Did you see any errors in the console when you imported all the packages? Also, do you have an MRTK folder in your Assets? The MRTK Standard Assets should import some shaders, including what looks to be the one you're missing in your screenshot.

To try to get those shaders to import, can you try selecting this menu item?

image

Arthr702 commented 3 years ago

Same issue here: After checking for Shader updates I got the following error

DirectoryNotFoundException: Could not find a part of the path 'D:\ExampleProject\Library\PackageCache\com.microsoft.mixedreality.worldlockingtools@c74fd40f002f-1627456544624\Packages\Microsoft.MixedReality.Unity.FrozenWorld.Engine.1.1.1\lib\unity\iOS-ARM64\FrozenWorldPlugin.framework\_CodeSignature'. System.IO.__Error.WinIOError (System.Int32 errorCode, System.String maybeFullPath) (at <695d1cc93cca45069c528c15c9fdd749>:0) System.IO.FileSystemEnumerableIterator1[TSource].HandleError (System.Int32 hr, System.String path) (at <695d1cc93cca45069c528c15c9fdd749>:0) System.IO.FileSystemEnumerableIterator1[TSource].CommonInit () (at <695d1cc93cca45069c528c15c9fdd749>:0) System.IO.FileSystemEnumerableIterator1[TSource]..ctor (System.String path, System.String originalUserPath, System.String searchPattern, System.IO.SearchOption searchOption, System.IO.SearchResultHandler1[TSource] resultHandler, System.Boolean checkHost) (at <695d1cc93cca45069c528c15c9fdd749>:0) System.IO.FileSystemEnumerableFactory.CreateFileNameIterator (System.String path, System.String originalUserPath, System.String searchPattern, System.Boolean includeFiles, System.Boolean includeDirs, System.IO.SearchOption searchOption, System.Boolean checkHost) (at <695d1cc93cca45069c528c15c9fdd749>:0) System.IO.Directory.InternalGetFileDirectoryNames (System.String path, System.String userPathOriginal, System.String searchPattern, System.Boolean includeFiles, System.Boolean includeDirs, System.IO.SearchOption searchOption, System.Boolean checkHost) (at <695d1cc93cca45069c528c15c9fdd749>:0) System.IO.Directory.InternalGetFiles (System.String path, System.String searchPattern, System.IO.SearchOption searchOption) (at <695d1cc93cca45069c528c15c9fdd749>:0) System.IO.Directory.GetFiles (System.String path, System.String searchPattern) (at <695d1cc93cca45069c528c15c9fdd749>:0) System.IO.DirectoryInfo.GetFiles (System.String searchPattern) (at <695d1cc93cca45069c528c15c9fdd749>:0) System.IO.DirectoryInfo.GetFilesSubdirs (System.Collections.ArrayList l, System.String pattern) (at <695d1cc93cca45069c528c15c9fdd749>:0) (wrapper remoting-invoke-with-check) System.IO.DirectoryInfo.GetFilesSubdirs(System.Collections.ArrayList,string) System.IO.DirectoryInfo.GetFilesSubdirs (System.Collections.ArrayList l, System.String pattern) (at <695d1cc93cca45069c528c15c9fdd749>:0) (wrapper remoting-invoke-with-check) System.IO.DirectoryInfo.GetFilesSubdirs(System.Collections.ArrayList,string) System.IO.DirectoryInfo.GetFilesSubdirs (System.Collections.ArrayList l, System.String pattern) (at <695d1cc93cca45069c528c15c9fdd749>:0) (wrapper remoting-invoke-with-check) System.IO.DirectoryInfo.GetFilesSubdirs(System.Collections.ArrayList,string) System.IO.DirectoryInfo.GetFilesSubdirs (System.Collections.ArrayList l, System.String pattern) (at <695d1cc93cca45069c528c15c9fdd749>:0) (wrapper remoting-invoke-with-check) System.IO.DirectoryInfo.GetFilesSubdirs(System.Collections.ArrayList,string) System.IO.DirectoryInfo.GetFilesSubdirs (System.Collections.ArrayList l, System.String pattern) (at <695d1cc93cca45069c528c15c9fdd749>:0) (wrapper remoting-invoke-with-check) System.IO.DirectoryInfo.GetFilesSubdirs(System.Collections.ArrayList,string) System.IO.DirectoryInfo.GetFilesSubdirs (System.Collections.ArrayList l, System.String pattern) (at <695d1cc93cca45069c528c15c9fdd749>:0) (wrapper remoting-invoke-with-check) System.IO.DirectoryInfo.GetFilesSubdirs(System.Collections.ArrayList,string) System.IO.DirectoryInfo.GetFilesSubdirs (System.Collections.ArrayList l, System.String pattern) (at <695d1cc93cca45069c528c15c9fdd749>:0) (wrapper remoting-invoke-with-check) System.IO.DirectoryInfo.GetFilesSubdirs(System.Collections.ArrayList,string) System.IO.DirectoryInfo.GetFilesSubdirs (System.Collections.ArrayList l, System.String pattern) (at <695d1cc93cca45069c528c15c9fdd749>:0) (wrapper remoting-invoke-with-check) System.IO.DirectoryInfo.GetFilesSubdirs(System.Collections.ArrayList,string) System.IO.DirectoryInfo.GetFilesSubdirs (System.Collections.ArrayList l, System.String pattern) (at <695d1cc93cca45069c528c15c9fdd749>:0) System.IO.DirectoryInfo.GetFiles (System.String searchPattern, System.IO.SearchOption searchOption) (at <695d1cc93cca45069c528c15c9fdd749>:0) (wrapper remoting-invoke-with-check) System.IO.DirectoryInfo.GetFiles(string,System.IO.SearchOption) Microsoft.MixedReality.Toolkit.Utilities.Editor.OnLoadUtilities.FindShaderFolderInPackage () (at Library/PackageCache/com.microsoft.mixedreality.toolkit.standardassets@38243c36b7e4-1627456531506/EditorUtilities/OnLoadUtilities.cs:152) Microsoft.MixedReality.Toolkit.Utilities.Editor.OnLoadUtilities.EnsureShaders (System.Boolean bypassIgnore) (at Library/PackageCache/com.microsoft.mixedreality.toolkit.standardassets@38243c36b7e4-1627456531506/EditorUtilities/OnLoadUtilities.cs:42) Microsoft.MixedReality.Toolkit.Utilities.Editor.OnLoadUtilities..cctor () (at Library/PackageCache/com.microsoft.mixedreality.toolkit.standardassets@38243c36b7e4-1627456531506/EditorUtilities/OnLoadUtilities.cs:23) Rethrow as TypeInitializationException: The type initializer for 'Microsoft.MixedReality.Toolkit.Utilities.Editor.OnLoadUtilities' threw an exception. System.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor (System.RuntimeTypeHandle type) (at <695d1cc93cca45069c528c15c9fdd749>:0) UnityEditor.EditorAssemblies.ProcessInitializeOnLoadAttributes (System.Type[] types) (at <44c3723143904fb88deebc993c7bb491>:0)

MaxWang-MS commented 3 years ago

Hi @Arthr702 are you also following the tutorial? It seems that you are encountering some issue related to the WLT package but that is independent to MRTK. Could you try again and just import the MRTK packages (and the OpenXR one if you are following the tutorial/using OpenXR) and see if the issue still exists?

Arthr702 commented 3 years ago

Hi @MaxWang-MS yes I have followed this tutorial. Removing the WLT Core package manually from the project solved the error for me. So "Check for shader updates" didn't show any other issues. The incorrect preview for the material in the Unitys project window still persists, but clicking on the material will show the correct result.

jiedaokou commented 3 years ago

@MaxWang-MS 你好,我按教程操作遇到了同样的问题 问题原因:怀疑是MixedRealityFeatureTool工具没有成功导入MRTK Standard Assets包,导入后的Assets文件夹里没有出现下图所示的MRTK和Shaders文件夹,造成了材质丢失 image

解决办法:在MixedRealityFeatureTool工具的Discover features界面,除了勾选教程中所说的两项,再勾选MRTK Standard Assets包,如下图所示。其他步骤按教程来,经我测试后,问题消失。@Arthr702 @danzeeeman

image

关于MixedRealityFeatureTool工具的疑问:按教程中所述,在MixedRealityFeatureTool工具的Import features界面也会自动帮我们勾选,但在这个界面,MRTK Standard Assets包好像并不会自动下载,而初学者电脑里没有缓存,所以按照教程操作会导致导入失败???

MaxWang-MS commented 3 years ago

@jiedaokou 感谢你的反馈。请问你可以告知我们你所使用的MixedRealityFeatureTool的版本吗?在一打开工具的第一个页面上就有版本号。我们目前怀疑这个问题可能跟MRFT有关。 关于无法自动导入Standard Assets包的问题,正如你所说的按照设计即使你在你截图的这个页面中只勾选MRTK Foundation但不勾选standard assets,在点击Get Features按钮后standard assets也应该出现在Required dependencies一栏中。而standard assets包的下载会在你点击get features按钮后进入下一个界面前完成(程序知道standard assets是foundation的依赖所以会先把包自动下载下来),所以按照教程进行操作不应该导致导入失败。 关于你提到的按照教程操作也出现材质丢失的问题,请问这种情况是偶发的还是一直都在出现呢?我们目前无法复现所以希望你可以给我们提供更多信息,谢谢!

jiedaokou commented 3 years ago

您好:

  1. MixedRealityFeatureTool的版本号是v1.0.2104.4 Beta
  2. 材质丢失的问题是一直出现的,unity3d 2020.3.16和unity3d 2021.1.16都出现了该问题 3. 我在其他论坛上也看到有人报告了该问题,他们是通过手动导入shader包解决的

------------------ 原始邮件 ------------------ 发件人: "microsoft/MixedRealityToolkit-Unity" @.>; 发送时间: 2021年8月19日(星期四) 凌晨3:59 @.>; @.**@.>; 主题: Re: [microsoft/MixedRealityToolkit-Unity] Shader Errors when setting up an Example project via HoloLens 2 tutorials (#10114)

@jiedaokou 感谢你的反馈。请问你可以告知我们你所使用的MixedRealityFeatureTool的版本吗?在一打开工具的第一个页面上就有版本号。我们目前怀疑这个问题可能跟MRFT有关。 关于无法自动导入Standard Assets包的问题,正如你所说的按照设计即使你在你截图的这个页面中只勾选MRTK Foundation但不勾选standard assets,在点击Get Features按钮后standard assets也应该出现在Required dependencies一栏中。而standard assets包的下载会在你点击get features按钮后进入下一个界面前完成(程序知道standard assets是foundation的依赖所以会先把包自动下载下来),所以按照教程进行操作不应该导致导入失败。 关于你提到的按照教程操作也出现材质丢失的问题,请问这种情况是偶发的还是一直都在出现呢?我们目前无法复现所以希望你可以给我们提供更多信息,谢谢!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

MaxWang-MS commented 3 years ago

@jiedaokou 感谢您的回复。我们这边可能需要更多的信息来复现并解决这个问题,如果可以的话可以请您打开出现问题的电脑上的MixedRealityFeatureTool,在首页点击左下角的小齿轮图标进入Settings,再选择Diagnostics栏,最后按照软件上显示的地址找到log文件并将文件发给我们吗?

jiedaokou commented 3 years ago

您好,邮件附件里是log文件,但打开后只显示了软件的版本号,路径见下图。

------------------ 原始邮件 ------------------ 发件人: "microsoft/MixedRealityToolkit-Unity" @.>; 发送时间: 2021年8月24日(星期二) 中午11:12 @.>; @.**@.>; 主题: Re: [microsoft/MixedRealityToolkit-Unity] Shader Errors when setting up an Example project via HoloLens 2 tutorials (#10114)

@jiedaokou 感谢您的回复。我们这边可能需要更多的信息来复现并解决这个问题,如果可以的话可以请您打开出现问题的电脑上的MixedRealityFeatureTool,在首页点击左下角的小齿轮图标进入Settings,再选择Diagnostics栏,最后按照软件上显示的地址找到log文件并将文件发给我们吗?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

IssueSyncBot commented 10 months ago

We appreciate your feedback and thank you for reporting this issue.

Microsoft Mixed Reality Toolkit version 2 (MRTK2) is currently in limited support. This means that Microsoft is only fixing high priority security issues. Unfortunately, this issue does not meet the necessary priority and will be closed. If you strongly feel that this issue deserves more attention, please open a new issue and explain why it is important.

Microsoft recommends that all new HoloLens 2 Unity applications use MRTK3 instead of MRTK2.

Please note that MRTK3 was released in August 2023. It features an all-new architecture for developing rich mixed reality experiences and has a minimum requirement of Unity 2021.3 LTS. For more information about MRTK3, please visit https://www.mixedrealitytoolkit.org.

Thank you for your continued support of the Mixed Reality Toolkit!