Version: Unity 6.0 (6000.0)
语言 : 中文
在企业中部署 Unity
通过 Web 代理使用 Unity

允许标准用户 (Windows) 安装 Unity

默认情况下,安装 Unity Editor 的过程需要管理员权限。

从 2023.1 版本开始,在 Windows 系统上,标准用户可以在无需提升权限的情况下安装 Unity Editor。

启用此功能后,管理员只需安装 Unity 安装程序检测到的缺失依赖项(例如 Visual C++ 运行时库),从而减少安装工作量。这些依赖项很少变化,因此标准用户每次安装其他 Unity Editor 实例时都不需要管理员干预。

开始之前

确保您有 C:\ProgramData\Unity\config 文件夹的写入权限。

编辑 JSON 文件时,请务必遵循以下做法:

  • 使用直双引号 (""),不使用弯引号 (“”)。
  • 使用逗号分隔键值 (key:value) 对。
  • 使用验证器检查 JSON 的语法。您可以在 PowerShell 中使用 Get-ContentConvertFrom-Json cmdlet,如此示例所示。

步骤

要使标准用户能够安装 Unity Editor:

  1. 确保存在以下路径。如有必要,创建其任何文件夹:

    C:\ProgramData\Unity\config
    
  2. 确保以下文件存在。如有必要,创建:

    C:\ProgramData\Unity\config\services-config.json
    

    如果需要创建文件,请确保文件至少包含以下内容:

    {  
    }
    
  3. services-config.json 中的大括号之间添加以下条目:

    "hubDisableElevate": true
    
  4. 可选:要允许同一台计算机的多个用户共享 Unity Editor 二进制文件而无需多次安装同一版本,可以创建一个文件夹,作为所有 Unity Editor(例如 C:\UnityEditors)的通用目标文件夹。重要提示:请确保授予所有用户 对此文件夹的读取写入访问权限。

  5. 可选:如果在上一步中创建了公共文件夹,请将 machineWideSecondaryInstallLocation 键添加到 services-config.json,以使 Unity Hub 能使用此文件夹。使用上一步中的文件夹,条目如下所示:

    "machineWideSecondaryInstallLocation": "C:\\UnityEditors"
    
  6. 退出 Unity Hub 并确保其停止,而不仅仅是最小化到任务栏。

配置文件示例

使用上述过程的值,示例 services-config.json 文件如下所示:

{
  "hubDisableElevate": true,
  "machineWideSecondaryInstallLocation": "C:\\UnityEditors"
}

后续步骤

除非存在依赖项,否则标准用户的计算机现在可以安装 Unity Editor,无需管理员干预。管理员必须安装所有依赖项。

缺少依赖项警告

以下是标准用户可能看到的依赖项警告示例:

关于管理员必须安装的依赖项的缺失警告
关于管理员必须安装的依赖项的缺失警告

缺失依赖项列表

如果标准用户收到有关缺少依赖项的警告,安装程序会将依赖项列表写入文本文件。该警告会指明此文本文件的位置。管理员必须先安装这些依赖项,然后标准用户才能获得使用 Unity 的稳定体验。

以下是 Unity Installer 可能生成的缺失依赖项列表的示例:

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

其他资源

在企业中部署 Unity
通过 Web 代理使用 Unity