要使用 Unity,需要一个激活的许可证。
Unity Pro 和 Unity Personal 的主要许可证激活方法是 Unity Hub。有关激活 Unity 行业许可证的信息,请参阅 Unity 支持文章《如何激活或退回 Unity 行业许可证》。
以下信息介绍了 Unity Hub 的一种替代方法,即使用命令行激活和退回 Unity Pro 许可证。在以下情况下可以考虑此方法:
|
注意:以下程序不适用于 Unity Personal。 要激活和退回 Unity Personal 许可证,请分别登录和注销 Unity Hub。 |
如果您不知道自己的 Unity 许可证信息,请与许可证的所有者 (Owner) 联系。所有者可以通过组织 (Organization) 为您分配一个席位,或者您也可以联系 Unity 客户服务部。
在使用命令行激活 Unity 许可证之前,请确保许可证文件夹存在。请参阅许可证故障排除中的 Unity 许可证文件位置。此外,请确保您具有对此文件夹的写入权限。
在终端 (Terminal) 中输入以下命令以启动 Unity 并激活您的许可证:
<unity-command-location> -quit -batchmode -serial SB-XXXX-XXXX-XXXX-XXXX-XXXX -username 'name@example.com' -password 'XXXXXXXXXXXXX'
注意:
将 <unity-command-location> 替换为 Unity Editor 应用程序完整路径,并与 /Contents/MacOS/Unity 连接。例如,如果将 2022.2.0b4 Editor 安装到默认位置,则 <unity-command-location> 为:
/Applications/Unity/Hub/Editor/2022.2.0b4/Unity.app/Contents/MacOS/Unity
如果要激活指定的用户许可证而不激活其序列号,请使用相同的命令,但在指定 -serial 关键字后省略序列号:
... -serial -username 'name@example.com' -password 'XXXXXXXXXXXXX'
以下示例将激活指定的用户许可证,但不激活其序列号:
/Applications/Unity/Hub/Editor/2022.2.0b4/Unity.app/Contents/MacOS/Unity -quit -batchmode -serial -username 'name@example.com' -password 'XXXXXXXXXXXXX'
以下示例将激活序列号。如果您的计划支持指定用户许可,则会激活该许可证并激活其序列号。
/Applications/Unity/Hub/Editor/2022.2.0b4/Unity.app/Contents/MacOS/Unity -quit -batchmode -serial SB-XXXX-XXXX-XXXX-XXXX-XXXX -username 'name@example.com' -password 'XXXXXXXXXXXXX'
在命令行提示中输入以下命令以启动 Unity 并激活您的许可证:
"<editor-installation-location>" -quit -batchmode -serial E3-XXXX-XXXX-XXXX-XXXX-XXXX -username name@example.com -password XXXXXXXXXXXXX
注意:
将 <editor-installation-location> 替换为 Unity Editor 应用程序完整路径。例如,如果将 2022.2.0b4 Editor 安装到默认位置,则 <editor-installation-location> 为:
C:\Program Files\Unity\Hub\Editor\2022.2.0b4\Editor\Unity.exe
如果要激活指定的用户许可证而不激活其序列号,请使用相同的命令,但在指定 -serial 关键字后省略序列号:
... -serial -username 'name@example.com' -password 'XXXXXXXXXXXXX'
以下示例将激活指定的用户许可证,但不激活其序列号:
"C:\Program Files\Unity\Hub\Editor\2022.2.0b4\Editor\Unity.exe" -quit -batchmode -serial -username name@example.com -password XXXXXXXXXXXXX
以下示例将激活序列号。如果您的计划支持指定用户许可,则会激活该许可证并激活其序列号。
"C:\Program Files\Unity\Hub\Editor\2022.2.0b4\Editor\Unity.exe" -quit -batchmode -serial E3-XXXX-XXXX-XXXX-XXXX-XXXX -username name@example.com -password XXXXXXXXXXXXX
运行此命令后等待数秒钟,让 Unity 有足够的时间与许可证服务器进行通信。如果激活失败,您可以打开 Editor.log 查看信息。对于任何激活错误,请检查激活问题 (Activation issues) 为您的问题找到解决方案。
在终端 (Terminal) 中输入以下命令来退回许可证:
<unity-command-location> -quit -batchmode -returnlicense -username 'name@example.com' -password 'XXXXXXXXXXXXX'
将 <unity-command-location> 替换为 Unity Editor 应用程序完整路径,并与 /Contents/MacOS/Unity 连接。例如,如果将 2022.2.0b4 Editor 安装到默认位置,则 <unity-command-location> 为:
/Applications/Unity/Hub/Editor/2022.2.0b4/Unity.app/Contents/MacOS/Unity
/Applications/Unity/Hub/Editor/2022.2.0b4/Unity.app/Contents/MacOS/Unity -quit -batchmode -returnlicense -username 'name@example.com' -password 'XXXXXXXXXXXXX'
在命令提示符 (Command Prompt) 中输入以下命令来退回许可证:
"<editor-installation-location>" -quit -batchmode -returnlicense -username name@example.com -password XXXXXXXXXXXXX
将 <editor-installation-location> 替换为 Unity Editor 应用程序完整路径。例如,如果将 2022.2.0b4 Editor 安装到默认位置,则 <editor-installation-location> 为:
C:\Program Files\Unity\Hub\Editor\2022.2.0b4\Editor\Unity.exe
"C:\Program Files\Unity\Hub\Editor\2022.2.0b4\Editor\Unity.exe" -quit -batchmode -returnlicense -username name@example.com -password XXXXXXXXXXXXX
运行此命令后等待几秒钟,让 Unity 有足够的时间与许可证服务器进行通信。您可以使用 Hub 通过打开偏好设置 (Preferences) 菜单 (
) 并选择许可证 (Licenses) 来确认已退回许可证。如果您遇到问题,请参阅故障排除 (Troubleshooting)。