> For the complete documentation index, see [llms.txt](https://docs.edgegap.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.edgegap.com/zh/unity/developer-tools.md).

# 开发者工具

我们为你打造这些工具，秉持一个简单的信条：“成功团队的关键在于快速迭代和频繁测试”。如果你发现任何改进机会，请在我们的 [社区 Discord](https://discord.gg/NgCnkHbsGp). 我们希望你能享受顺畅的体验。🚀

{% hint style="info" %}
[查找真实世界示例](/zh/docs/sample-projects/unity-netcodes.md) 你可以将其用作项目起点，并进一步修改。
{% endhint %}

#### 语义化版本控制

我们的开发者工具和托管服务使用官方 [语义化版本控制](https://semver.org/)，表明哪些更新是✅安全的（次要、补丁），哪些可能包含⚠️破坏性更改（主要）。

**一旦某个版本发布，它将永远不会被修改/更改**.

## ⚡ 专用服务器快速入门插件

直接从 Unity 编辑器中构建并将你的专用游戏服务器部署到云端！

* [适用于 Unity 的专用服务器插件——交钥匙解决方案、源代码和完整发布说明。](https://github.com/edgegap/edgegap-unity-plugin)

{% hint style="success" %}
本插件在免费套餐条款和条件下 100% 免费提供。
{% endhint %}

2021.3 及之后的所有 Unity3D 长期支持（LTS）版本均受官方支持。

本插件包含旨在帮助你：

* 为 Linux 构建并容器化你的专用服务器，
* 在本地测试你的服务器 Docker 镜像，
* 将你的服务器上传并部署到 Edgegap。

{% hint style="info" %}
本插件不会修改任何游戏行为，它只是一个用于 Edgegap 任务的便捷开发工具。该插件不会包含在你的构建中，因为它仅在服务器构建准备期间使用。
{% endhint %}

#### 安装

请参阅 [官方插件仓库](https://github.com/edgegap/edgegap-unity-plugin) 有关安装的详细说明。

该插件已通过测试，支持 Unity 2021.2+ 版本，包括所有 LTS 版本、Unity 2023 和 Unity 6。

{% embed url="<https://youtu.be/3a5veDyxpoE>" %}

<details>

<summary>安装 Unity Linux 构建支持模块</summary>

* 使用 Unity Hub 选择 选项卡 **安装**，访问 **设置** 和 **添加模块** 对于您打算与 Edgegap 平台一起使用的每个 Unity 版本：

<figure><img src="/files/563f83de58ec91755c48c56b82376f73e54bdde9" alt=""><figcaption></figcaption></figure>

* 向下滚动以选择并安装以下 Unity 模块：
  * **Linux 构建支持（IL2CPP），**
    * **Linux 构建支持（Mono），**
    * **Linux 专用服务器构建支持**

<figure><img src="/files/fab307f7657f39c2c6dff6cae4911cbc8460b8ea" alt=""><figcaption></figcaption></figure>

</details>

<details>

<summary><a href="https://www.docker.com/products/docker-desktop/">安装 Docker Desktop（或 Docker CLI）</a></summary>

* [从官方来源安装 Docker Desktop](https://www.docker.com/products/docker-desktop/) （无需账户）。
* 完成安装后重启计算机。

</details>

{% hint style="success" %}
查看 [Unity](/zh/unity.md) 以开始使用并获取插件使用的详细说明。
{% endhint %}

<details>

<summary>故障排除与常见问题</summary>

Unity 错误： `[包管理器窗口] 添加包时出错：https://github.com/edgegap/edgegap-unity-plugin.git`

* 要通过 git URL 添加我们的插件，你需要安装 git 客户端（[#installation](#installation "mention")).

***

Unity 错误： `缺少 Linux 构建支持`

* 查看 [#usage-requirements](#usage-requirements "mention")，你很可能缺少 Linux 构建支持模块，你可以通过 Unity Hub 安装它们。请确保选择与你项目相同的 Unity 版本。

</details>

{% hint style="info" %}
如果你需要帮助， [请通过 Discord 联系我们](https://discord.gg/MmJf8fWjnt)。关于实时游戏支持，请查看我们的 [工单系统](https://edgegap.atlassian.net/servicedesk/customer/portal/3).
{% endhint %}

{% hint style="info" %}
**面向插件开发者** - 如果你希望在用户的编辑器中检测此插件的存在，可以使用编译指令 `#if EDGEGAP_PLUGIN_SERVERS {你的代码} #endif` .
{% endhint %}

## ⭐ 软件开发工具包

Unity SDK 包含用于部署、匹配和服务器浏览器的可选集成工具。此插件官方支持 Unity 2021.3.0f1 及更高版本。

{% hint style="info" %}
**Unity SDK 的最新版本是 `3.4.0`**。本文档中的所有示例均为最新。
{% endhint %}

{% hint style="success" %}
此插件完全免费提供，遵循免费层的条款和条件。
{% endhint %}

#### 要求

<details>

<summary>安装一个 Git 客户端（例如 <a href="https://git-scm.com/">git-scm</a>)</summary>

Unity 需要 Git 客户端来自动下载并安装我们的 Unity 包。安装后，您将不需要直接使用 git。

</details>

#### 安装

1. 打开您的 Unity 项目，
2. 选择 `窗口 > 包管理 > 包管理器` ,
3. 点击 :heavy\_plus\_sign: 图标并选择 `从 git URL 添加包...` ,
4. 在提示时输入我们 SDK 的 URL：

{% code title="" %}

```
https://github.com/edgegap/edgegap-unity-sdk.git
```

{% endcode %}

5. 点击 `添加`  并等待安装完成。

#### 导入示例

此包包含多个示例，旨在单独使用（不要将示例组合在一起）。

#### 已验证来源

这是该 SDK 唯一官方分发渠道，请不要信任未经验证的来源！

#### 更新包

在 Unity Package Manager 中导航到 Edgegap SDK 并点击 `更新` .

{% hint style="warning" %}
**导入的示例不会自动更新！** 备份任何自定义属性值，删除当前场景中使用的示例脚本，然后重新导入示例。
{% endhint %}

{% hint style="info" %}
某些版本可能包含破坏性更改。这将由新的 MAJOR 版本标明。
{% endhint %}

#### 更新到 v3

此次更新包含许多新的 [服务器浏览器](/zh/unity/fu-wu-qi-liu-lan-qi.md) 工具和示例，改进了匹配错误处理，以及更多内容。请参见 [发行说明](/zh/docs/release-notes.md) 以获取完整列表。

{% hint style="warning" %}
Unity SDK v3 更新包含一些破坏性更改。请仔细重新测试您的集成。
{% endhint %}

<details>

<summary>故障排除与常见问题</summary>

Unity： `[包管理器窗口] 添加包时出错：https://github.com/edgegap/edgegap-unity-sdk.git`

* 要通过 git URL 添加我们的插件，你需要安装 git 客户端。

***

Visual Studio： `找不到类型或命名空间名称` ，适用于 Edgegap 命名空间。

1. 在 Unity 编辑器中，导航到 **编辑 / 首选项 / 外部工具 / 生成 .csproj 文件**.
2. 请确保你已启用 **Git 包**.
3. 点击 **重新生成项目文件**.

</details>

{% hint style="info" %}
如果你需要帮助， [请通过 Discord 联系我们](https://discord.gg/MmJf8fWjnt)。关于实时游戏支持，请查看我们的 [工单系统](https://edgegap.atlassian.net/servicedesk/customer/portal/3).
{% endhint %}

## 📫 分布式中继传输库

为你的网络代码库寻找一个自定义 Transport，以便在点对点游戏中利用分布式中继。

[查看文档](/zh/learn/distributed-relay/relay-transport-samples.md):

* 下载 Edgegap Relay 示例：
  * [Mirror 示例](https://github.com/edgegap/unity-mirror-relay-sample),
  * [FishNet 示例](https://github.com/edgegap/unity-fishnet-relay-sample),
  * [Unity NGO 示例](https://github.com/edgegap/unity-ngo-relay-sample).
* [Edgegap Relay 传输库——支持的网络代码的源代码和发布说明。](https://github.com/edgegap/distributed-relay-examples)
