包含此页的版本:
不含此页的版本:
默认情况下,安装 Unity 编辑器是一个需要管理员权限的过程。
从 2023.1 开始,您可以允许 Windows 上的标准用户在没有提升权限的情况下安装 Unity 编辑器。
启用此功能后,可以减少管理员的参与,仅安装 Unity 安装程序检测到的缺失依赖项(例如 Visual C++ 运行时库)。这些依赖项很少更改,因此标准用户在每次安装 Unity 编辑器的其他实例时都不需要管理员干预。
确保您具有对C:\ProgramData\Unity\config文件夹。
编辑 JSON 文件时,请务必遵循以下做法:
Get-Content和ConvertFrom-Jsoncmdlet,如本示例所示。要使标准用户能够安装 Unity 编辑器,请执行以下作:
确保存在以下路径。如有必要,创建其任何文件夹:
C:\ProgramData\Unity\config
确保存在以下文件。如有必要,请创建它:
C:\ProgramData\Unity\config\services-config.json
如果需要创建文件,请确保它至少包含以下内容:
{
}
在大括号之间添加以下条目services-config.json:
"hubDisableElevate": true
可选:要允许同一台计算机的多个用户共享 Unity 编辑器二进制文件而无需多次安装同一版本,请创建一个文件夹,该文件夹将成为所有 Unity 编辑器的通用目标,例如C:\UnityEditors.重要提示:确保为“所有用户”授予对此文件夹的“读”和“写”权限。
可选:如果您在上一步中创建了公共文件夹,请将machineWideSecondaryInstallLocation关键services-config.json,使 Unity Hub 使用此文件夹。使用上一步中的文件夹,条目如下所示:
"machineWideSecondaryInstallLocation": "C:\\UnityEditors"
退出 Unity Hub 并确保它已停止,而不仅仅是最小化到任务栏。
使用上述过程中的值,示例services-config.json文件如下所示:
{
"hubDisableElevate": true,
"machineWideSecondaryInstallLocation": "C:\\UnityEditors"
}
标准用户的计算机现在可以在没有管理员干预的情况下安装 Unity 编辑器,除非存在依赖关系。管理员必须安装任何依赖项。
下面是标准用户可能会看到的依赖项警告示例:
如果标准用户收到有关缺少依赖项的警告,安装程序会将依赖项列表写入文本文件。警告标识此文本文件的位置。管理员必须先安装这些依赖项,然后标准用户才能获得稳定的 Unity 体验。
下面是 Unity 安装程序可能生成的缺失依赖项列表的示例:
Dependency: Visual C++ 2010 runtime (x64)
Download location: https://www.microsoft.com/en-ca/download/details.aspx?id=26999
Local Installer: C:\Users\nonadmin\AppData\Local\Unity 2023.1.0a5\MissingDependencies\vcredist_x64_2010.exe
Dependency: Visual C++ 2013 runtime (x64)
Download location: https://www.microsoft.com/en-ca/download/details.aspx?id=40784
Local Installer: C:\Users\nonadmin\AppData\Local\Unity 2023.1.0a5\MissingDependencies\vcredist_x64_2013.exe
Dependency: Visual C++ 2015 runtime (x64)
Download location: https://www.microsoft.com/en-ca/download/details.aspx?id=48145
Local Installer: C:\Users\nonadmin\AppData\Local\Unity 2023.1.0a5\MissingDependencies\vcredist_x64_2015.exe
Make sure that the following rules are set:
netsh advfirewall firewall delete rule name=all program='C:\Users\nonadmin\AppData\Local\Unity 2023.1.0a5\Editor\Unity.exe'
netsh advfirewall firewall delete rule name=all program='C:\Users\nonadmin\AppData\Local\Unity 2023.1.0a5\Editor\Data\Tools\nodejs\node.exe'
netsh advfirewall firewall add rule name='Unity 2023.1.0a5 Editor' dir=in action=allow program='C:\Users\nonadmin\AppData\Local\Unity 2023.1.0a5\Editor\Unity.exe' profile=domain protocol=any
netsh advfirewall firewall add rule name='Unity 2023.1.0a5 Editor' dir=in action=block program='C:\Users\nonadmin\AppData\Local\Unity 2023.1.0a5\Editor\Unity.exe' profile=public protocol=any