選擇 Unity 版本和 XR 外掛程式Choosing a Unity version and XR plugin

雖然我們目前 建議您安裝 unity 2019.4 LTS,並使用舊版內建 XR 進行混合現實開發,但您也可以使用其他 Unity 設定來建立應用程式。While we currently recommend installing Unity 2019.4 LTS and using Legacy Built-in XR for Mixed Reality development, you can build apps with other Unity configurations as well.

Microsoft 目前針對 HoloLens 2 和 Windows Mixed Reality 開發建議的 Unity 設定,是 使用舊版內建 XR 支援的 unity 2019.4 LTSMicrosoft’s current recommended Unity configuration for HoloLens 2 and Windows Mixed Reality development is Unity 2019.4 LTS using Legacy Built-in XR support.

安裝和管理 Unity 的最佳方式是透過 [Unity 中樞]The best way to install and manage Unity is through the [Unity Hub]. 安裝之後,請開啟 Unity Hub:When it's installed, open Unity Hub:

  1. 選取 [安裝] 索引標籤,然後選擇 [新增]Select the Installs tab and choose ADD
  2. 選取 Unity 2019.4 LTS,然後按 [下一步]Select Unity 2019.4 LTS and click Next

Unity 中樞定新版本

  1. 檢查「平臺」底下 下列元件Check following components under 'Platforms'
    • 通用 Windows 平臺組建支援Universal Windows Platform Build Support
    • Windows Build 支援 (IL2CPP)Windows Build Support (IL2CPP)

Unity 通用 Windows 平臺組建支援選項

  1. 如果您已安裝 Unity 但未安裝這些選項,您可以透過 Unity Hub 中 的 [新增模組 ] 功能表來新增這些選項:If you installed Unity without these options, you can add them through 'Add Modules' menu in Unity Hub:

Unity Windows Build 支援選項

若要開始使用 Unity 2019.4 LTS 中的舊版內建 XR,請按一下這裡:To get started with Legacy Built-in XR in Unity 2019.4 LTS, click here:

注意

Unity 已淘汰自 Unity 2019 起的舊版內建 XR 支援。Unity has deprecated its Legacy Built-in XR support as of Unity 2019. 雖然 Unity 2019 提供新的 XR 外掛程式架構,但 Microsoft 目前不建議在 Unity 2019 中使用該路徑,因為 Azure 空間錨點與 AR Foundation 2 不相容。While Unity 2019 does offer a new XR Plug-in framework, Microsoft is not currently recommending that path in Unity 2019 due to Azure Spatial Anchors incompatibilities with AR Foundation 2. 在 Unity 2020 中,XR 外掛程式架構內支援 Azure 空間錨點。In Unity 2020, Azure Spatial Anchors is supported within the XR Plug-in framework.

如果您正在開發適用于 HoloLens (第一代) 的應用程式,則 Unity 2019 LTS 會持續支援這些耳機,並具備舊版內建 XR,可在 Unity 2019 LTS 的完整生命週期內透過中2022。If you are developing apps for HoloLens (1st gen), these headsets remain supported in Unity 2019 LTS with Legacy Built-in XR for the full lifecycle of Unity 2019 LTS through mid-2022.

Unity 2020.3 LTSUnity 2020.3 LTS

如果您是使用 Unity 2020.3 LTS,Microsoft 目前的建議是最新的 混合現實 OpenXR 外掛程式If you’re using Unity 2020.3 LTS, Microsoft’s current recommendation is the latest Mixed Reality OpenXR plugin. 您必須使用 Unity patch release 2020.3.8 f1 或更新版本,以避免早于2020.3 組建的已知效能問題。You MUST use Unity patch release 2020.3.8f1 or later to avoid known performance issues with earlier 2020.3 builds.

Mixed Reality OpenXR 外掛程式完全支援 AR Foundation 4.0,提供 ARPlaneManager 和 ARRaycastManager 執行。The Mixed Reality OpenXR plugin fully supports AR Foundation 4.0, providing ARPlaneManager and ARRaycastManager implementations. 如此一來,您就可以撰寫點擊測試程式碼,然後跨越 HoloLens 2 和 ARCore/ARKit 的手機和平板電腦。This enables you to write hit-testing code once that then spans HoloLens 2 and ARCore/ARKit phones and tablets.

不過,有一些已知的問題會影響 Unity 2020 LTS 專案:However, there are known issues that affect Unity 2020 LTS projects:

  • (URP) 10.5.0 或較舊版本的通用轉譯管線,在 HoloLens 2 裝置上的效能會受到負面影響。The Universal Rendering Pipeline (URP) 10.5.0 or older has performance penalties on HoloLens 2 devices.

如果您選擇在目前的 Unity 2020 中開始新的專案,請務必在推出您的應用程式之前,先追蹤更新 Unity 組建和 URP 套件的後續幾周。If you choose to start a new project in Unity 2020 today, be sure to follow up over the coming weeks for updated Unity builds and URP packages before shipping your app. 這可確保您的使用者體驗適當的全息圖穩定性。This will ensure that your users experience proper hologram stability.

Unity 2021。1Unity 2021.1

如果您正在嘗試早期的 Unity 2021.1 組建,您應該移至 OpenXR 外掛程式,因為 Windows XR 外掛程式已在該處淘汰。If you are trying out early Unity 2021.1 builds, you should move forward to the OpenXR plugin, as the Windows XR plugin is deprecated there. 從 Unity 2021.2 開始,OpenXR 外掛程式將是唯一開發混合現實的途徑,因為 Windows XR 外掛程式將不再受到支援。Starting in Unity 2021.2, the OpenXR plugin will be the only path for Mixed Reality development, as the Windows XR plugin will no longer be supported.

Unity 2018.4 LTSUnity 2018.4 LTS

如果您已經有使用 Unity 2018.4 LTS 的專案,則您的 Unity 引擎會在發行後的2年繼續受到支援。If you already have a project using Unity 2018.4 LTS, your Unity engine continues to be supported for 2 years after its release. Unity 2018 LTS 將于2021年春季結束服務。Unity 2018 LTS will reach end of service in the spring of 2021.