使用 MRTK3 包

Microsoft MRTK3 是作为一组已使用适用于 Unity 的混合现实功能工具和 Unity 包管理器 (UPM) 导入到 Unity 中的包分发的。 这些包使开发人员能够自定义其项目中的 MRTK。

依赖项

某些 MRTK3 包需要 Microsoft 和/或 Unity 提供的其他包才能正常运行。 其中一些包是可选的,用于启用附加功能。

下图说明了 MRTK 包与某些 Unity 依赖项之间的关系。

MRTK3 Package Graph

注意

使用混合现实功能工具导入包时,会自动执行依赖项管理。

下表介绍了混合现实工具包的包依赖项。

显示名称 包名称 说明 必须 可选
MRTK 核心定义 com.microsoft.mrtk.core 共享的定义、实用工具和组件。
  • com.unity.xr.interaction.toolkit
  • com.unity.xr.management
MRTK 辅助功能 com.microsoft.mrtk.accessibility 定义、功能和子系统,用于构建可访问的混合现实体验。
  • com.microsoft.mrtk.core
  • com.microsoft.mrtk.graphicstools.unity
  • com.unity.textmeshpro
MRTK 音频效果 com.microsoft.mrtk.audio 用于增强混合现实体验中音频的效果和功能。
  • com.microsoft.mrtk.core
MRTK 数据绑定和主题 com.microsoft.mrtk.data 对数据绑定和 UI 元素主题的支持。
  • com.microsoft.mrtk.core
  • com.unity.nuget.newtonsoft-json
  • com.unity.textmeshpro
MRTK 诊断 com.microsoft.mrtk.diagnostics 诊断和性能监视子系统和工具。
  • com.microsoft.mrtk.core
  • com.unity.xr.management
MRTK 环境 com.microsoft.mrtk.environment 环境功能和子系统,例如空间感知和边界。
  • com.microsoft.mrtk.core
  • com.unity.xr.management
MRTK 扩展资产 com.microsoft.mrtk.extendedassets 可供在应用程序中使用的附加音频、字体、纹理和其他资产。
  • com.microsoft.mrtk.standardassets
  • com.microsoft.mrtk.graphicstools.unity
MRTK 图形工具 com.microsoft.mrtk.graphicstools.unity 着色器、纹理、材料和模型。
  • com.unity.render-pipelines.universal
MRTK 输入 com.microsoft.mrtk.input 输入组件,包括对关节手、脱机语音识别和编辑器内输入模拟的支持。
  • com.microsoft.mrtk.core
  • com.microsoft.mrtk.graphicstools.unity
  • com.unity.xr.interaction.toolkit
  • com.unity.inputsystem
  • com.unity.xr.management
  • com.unity.xr.openxr
  • com.unity.xr.arfoundation
MRTK 空间操作 com.microsoft.mrtk.spatialmanipulation 空间定位和操作组件与实用工具,包括求解器。
  • com.microsoft.mrtk.core
  • com.microsoft.mrtk.uxcore
  • com.unity.inputsystem
  • com.unity.xr.interaction.toolkit
  • com.microsoft.mrtk.input
MRTK 标准资产 com.microsoft.mrtk.standardassets 供应用程序使用的标准资产,包括材料和纹理。
  • com.microsoft.mrtk.graphicstools.unity
MRTK 工具 com.microsoft.mrtk.tools 用于扩展和优化 MRTK3 应用程序的 Unity 编辑器工具集合。
  • com.microsoft.mrtk.core
MRTK UX 组件 com.microsoft.mrtk.uxcomponents MRTK UX 组件库,包含预制件、视觉对象、预制控件,以及开始为混合现实构建 3D 用户界面所需的一切。
  • com.microsoft.mrtk.uxcore
  • com.microsoft.mrtk.spatialmanipulation
  • com.microsoft.standardassets
MRTK UX 组件(非画布) com.microsoft.mrtk.uxcomponents.noncanvas MRTK 非画布 UX 组件库,用于生成没有画布布局的 3D UX。 对于大多数生产级 UI,建议使用 com.microsoft.mrtk.uxcomponents 中基于画布的动态混合 UX 系统。 但在某些情况下,静态/非画布 UI 可能会提供优化的性能和批处理,并且可能非常适用于资源受限的场景。
  • com.microsoft.mrtk.uxcore
  • com.microsoft.mrtk.spatialmanipulation
  • com.microsoft.standardassets
MRTK UX 核心 com.microsoft.mrtk.uxcore 用于构建 MR 用户界面组件的核心交互和可视化脚本。\n\n注意:此核心旨在用于构建 UX 库。 若要使用预先存在的组件库构建 MR 接口,请参阅 com.microsoft.mrtk.uxcomponents。
  • com.microsoft.mrtk.core
  • com.microsoft.mrtk.graphicstools.unity
  • com.unity.inputsystem
  • com.unity.textmeshpro
  • com.unity.xr.interaction.toolkit
  • com.microsoft.mrtk.data
MRTK Windows 语音 com.microsoft.mrtk.windowsspeech 本机 Windows 语音 API 的语音子系统实现。 允许使用本机 Windows 语音识别触发事件并驱动 XRI 交互。
  • com.microsoft.mrtk.core

运行包测试

某些 MRTK 包中包含用于验证所包含组件的测试。 在某些情况下,这些测试需要其他未断言为依赖项的 MRTK 包。

注意

将包导入 Unity 时,默认情况下不会编译测试程序集。 若要启用对测试的编译,请使用项目的 manifest.json 文件的 testables 元素。

为了最大程度地降低导入混合现实工具包的应用程序的开销,只会为了满足运行时需求而断言依赖项。 下表介绍了对包含的测试程序集启用编译和运行所需的其他包。

显示名称 包名称 测试要求
MRTK 核心定义 com.microsoft.mrtk.core
MRTK 辅助功能 com.microsoft.mrtk.accessibility
MRTK 数据绑定和主题 com.microsoft.mrtk.data
MRTK 诊断 com.microsoft.mrtk.diagnostics
MRTK 环境 com.microsoft.mrtk.environment
MRTK 扩展资产 com.microsoft.mrtk.extendedassets
MRTK 输入 com.microsoft.mrtk.input
MRTK 空间操作 com.microsoft.mrtk.spatialmanipulation
  • com.microsoft.mrtk.input
MRTK 标准资产 com.microsoft.mrtk.standardassets
MRTK UX 组件 com.microsoft.mrtk.uxcomponents
  • com.microsoft.mrtk.input
MRTK UX 核心 com.microsoft.mrtk.uxcore
  • com.microsoft.mrtk.input
MRTK Windows 语音 com.microsoft.mrtk.windowsspeech