unity3d - Unity 中用于 MRTKv2/Hololens2 的 2D 屏幕叠加
问题描述
我想在 Hololens2 上使用 Unity 制作 2D 屏幕叠加层。我创建了一个 Unity Canvas 设置为“屏幕空间 - 相机”渲染模式,并尝试将 MRTK 提供的相机添加为渲染相机。这导致了以下错误:
TargetParameterCountException: Number of parameters specified does not match the expected number.
System.Reflection.MonoMethod.ConvertValues (System.Reflection.Binder binder, System.Object[] args, System.Reflection.ParameterInfo[] pinfo, System.Globalization.CultureInfo culture, System.Reflection.BindingFlags invokeAttr) (at <567df3e0919241ba98db88bec4c6696f>:0)
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <567df3e0919241ba98db88bec4c6696f>:0)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <567df3e0919241ba98db88bec4c6696f>:0)
Microsoft.MixedReality.Toolkit.Input.MixedRealityCanvasInspector.AllRootCanvases () (at Assets/MixedRealityToolkit.Services/InputSystem/Editor/MixedRealityCanvasInspector.cs:206)
Microsoft.MixedReality.Toolkit.Input.MixedRealityCanvasInspector.OnInspectorGUI () (at Assets/MixedRealityToolkit.Services/InputSystem/Editor/MixedRealityCanvasInspector.cs:334)
UnityEditor.UIElements.InspectorElement+<CreateIMGUIInspectorFromEditor>c__AnonStorey1.<>m__0 () (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorElement.cs:501)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr) (at C:/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:179)
我不知道这是一个错误还是有意为之。我目前的解决方法是计算世界空间位置和相机前覆盖的尺寸。
有什么简单的方法可以让 Hololens2 渲染 2D 屏幕叠加层?
解决方案
推荐阅读
- mysql - Laravel Eloquent - 从关系中检索数据
- python - 有没有一种有效的方法来绘制季节图,以便在时间序列上保留顺序?
- bi-publisher - BI Publisher 突发结果返回“无可用数据”
- unity3d - Unity aab 不符合 Google Play 64 位要求
- javascript - 我有一个同时定义和未定义的变量
- android - 如何使 ConstraintLayout 中的 View 填充可用高度?
- unix - Unix在特定文本之后从文件中读取变量
- python - Matplotlib 甜甜圈标签/注释位置
- python - 如何根据来自选择字段的用户输入在表单中动态创建字段?
- laravel - 如何从 project1 导航到同一服务器上 project2 中的页面?