Unity MRTK场景理解DllNotFound报错及临时解决方法咨询
Unity + MRTK 开发场景理解模块相关问题
遇到的错误
DllNotFoundException: Microsoft.MixedReality.SceneUnderstanding.dll,报错位置:Library/PackageCache/com.microsoft.mixedreality.sceneunderstanding@7bfd3a8ea18c/Editor/Microsoft.MixedReality.SceneUnderstanding.cs:1179- 提示无法访问Scene Understanding Observer,需将构建目标设置为Universal Windows Platform(UWP),但已设置为UWP仍出现该错误
异常现象与怀疑点
场景启动时,Inspector面板中的MixedRealityToolkit组件会自动关闭,手动开启后功能恢复正常。怀疑是以下代码导致组件关闭:
public static async System.Threading.Tasks.Task<Microsoft.MixedReality.SceneUnderstanding.SceneObserverAccessStatus> RequestAccessAsync() { return await Task.Run(() => { Microsoft.MixedReality.SceneUnderstanding.SceneObserverAccessStatus result; Microsoft.MixedReality.SceneUnderstanding.NativeLibraryHelpers.CheckStatus(Microsoft.MixedReality.SceneUnderstanding.NativeLibrary.su_scene_observer_request_access_async(out result)); return result; }); }
尝试修改该代码后仍报错,判断DLL缺失是核心问题。
当前临时解决方法
添加以下代码强制开启组件以忽略错误:
GameObject.Find("MixedRealityToolkit").GetComponent<MixedRealityToolkit>().enabled = true;
咨询问题
- 该临时解决方法是否合理?
- 问题的根源是什么?
内容的提问来源于stack exchange,提问作者LOUIS KIM
相关产品推荐
相关产品推荐

