在大型專案中使用 MRTK2

此頁面包含 MRTK 取用者將它提取至現有大型專案的一些實用秘訣,或設定將會受到原始檔控制且擁有多個開發人員的新專案。

我們建議閱讀下列所有指導方針,遵循這些指導方針有助於避免在處理較大的程式碼基底時發生一些棘手的問題

gitignore

下列 .gitignore 檔案是取用 MRTK 時建議的基底,其中有一部分的 MRTK 會建立原始檔控制可安全地忽略的本機狀態,否則會變更本機 Git 狀態。

請注意,本文的開頭部分取自預設 github Unity .gitignore,稍後再新增 MRTK 特定專案。 另請注意,其中有些規則假設有特定路徑,而且可以根據 MRTK 位於您的專案中的位置進行修改。

# This .gitignore file should be placed at the root of your Unity project directory
#
# Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore
#
/[Ll]ibrary/
/[Tt]emp/
/[Oo]bj/
/[Bb]uild/
/[Bb]uilds/
/[Ll]ogs/

# MemoryCaptures can get excessive in size.
# They also could contain extremely sensitive data
/[Mm]emoryCaptures/

# Asset meta data should only be ignored when the corresponding asset is also ignored
!/[Aa]ssets/**/*.meta

# Uncomment this line if you wish to ignore the asset store tools plugin
# /[Aa]ssets/AssetStoreTools*

# Autogenerated Jetbrains Rider plugin
/[Aa]ssets/Plugins/Editor/JetBrains*

# Visual Studio cache directory
.vs/

# Gradle cache directory
.gradle/

# Autogenerated VS/MD/Consulo solution and project files
ExportedObj/
.consulo/
*.csproj
*.unityproj
*.sln
*.suo
*.tmp
*.user
*.userprefs
*.pidb
*.booproj
*.svd
*.pdb
*.mdb
*.opendb
*.VC.db

# Unity3D generated meta files
*.pidb.meta
*.pdb.meta
*.mdb.meta

# Unity3D generated file on crash reports
sysinfo.txt

# Builds
*.apk
*.unitypackage

# Crashlytics generated file
crashlytics-build.properties

# NuGet Build Process Generated
# This section covers files that are generated when consuming/using MRTK from NuGet
# May not be relevant if consuming via .unitypackages
/NuGet/*
!/NuGet/BuildSource.proj
/MRTKBuild/
/MSBuild/
/PackagesCopy/
!/scripts/Packaging/NuGetRestoreProject.csproj

ProjectPreferences.asset 檔案

您可以在 [編輯 - 專案設定 - >> Mixed Reality工具組位置] 下找到全專案 MRTK 設定。 這些設定會儲存至 [資產] 資料夾中此位置的檔案:

Assets/MixedRealityToolkit.Generated/ProjectPreferences.asset

如果您的專案會有多個共同作業者,建議您在進行 MRTK 設定的初始設定之後,簽入此資產檔案。 特別是,請考慮 核取下列設定

鎖定 SDK 設定檔 - 如果停用,預設的 MRTK 設定檔將會全域編輯,這會使 MRTK 升級更具挑戰性, (可能會導致架構本身的合併衝突)

忽略 MRTK 專案設定器 - 如果停用此設定,則專案組態器會顯示目前的 MRTK 設定不符合 MRTK 建議的預設值。 由於您的專案可能明確選擇不啟用某些設定,因此已核取此設定可防止其他共同作業者不小心看到此對話方塊變更的設定。 這些設定應該由設定專案的人員設定,然後由其他共同作業者忽略。

自動啟用 UWP 功能 - 如果停用此功能,某些功能 (例如,當部署至裝置時,眼球追蹤) 可能會以無訊息方式失敗,因為 Unity 不會自動將所需的執行時間功能新增至應用程式資訊清單。 核取此設定可保護您的應用程式部署體驗,免于發生這類問題。