# 开发者工具

我们以一个简单的箴言为你构建这些工具：“成功团队的关键是快速迭代和频繁测试”。如果你看到改进的机会，请在我们的 [联系社区](https://discord.gg/NgCnkHbsGp)中告诉我们。希望你能享受顺畅的体验。🚀

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

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

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

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

{% hint style="success" %}
该插件在免费套餐的条款与条件下，100% 免费提供。
{% endhint %}

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

此插件包含旨在帮助你完成以下工作的功能：

* 将你的 Unity 项目连接到你的 Edgegap 账户，
* 构建你的专用游戏服务器，
* 将你的专用游戏服务器容器化，
* 在本地测试服务器的 Docker 镜像，
* 配置你的 Edgegap 应用版本，
* 在 Edgegap 云上部署你的服务器测试实例。

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

#### 安装

{% hint style="success" %}
参见 [](https://docs.edgegap.com/zh/unity "mention") 以开始使用，并获取有关插件用法的详细说明。
{% endhint %}

<details>

<summary>高级用户可能会对以下内容感兴趣：</summary>

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

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

***

Unity 错误： `缺少 Linux Build Support`

* 参见 [#usage-requirements](#usage-requirements "mention")，你很可能缺少 Linux Build Support 模块，你可以通过 Unity Hub 安装。请确保选择与你的项目相同的 Unity 版本。

</details>

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

## ⭐ 匹配（Matchmaking）SDK

{% hint style="success" %}
该插件在免费套餐的条款与条件下，100% 免费提供。
{% endhint %}

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

此插件包含旨在帮助你完成以下工作的功能：

* 使用单个票据启动和停止匹配，
* 从缓存的服务器分配中恢复匹配，
* 以小队/组队开始匹配，
* 使用 [ping-beacons](https://docs.edgegap.com/zh/learn/bian-pai/ping-beacons "mention") 进行延迟测量，
* 监控匹配器健康状况。

{% hint style="success" %}
使用我们的 [简单示例 Unity 示例脚本](https://github.com/edgegap/edgegap-unity-gen2-sdk?tab=readme-ov-file#import-simple-example) 在 5 分钟内测试匹配功能。
{% endhint %}

#### 安装

请参阅 [官方插件代码仓库](https://github.com/edgegap/edgegap-unity-gen2-sdk?tab=readme-ov-file#install-with-git-recommended) 以获取详细的安装说明。

{% hint style="success" %}
[在 Unity 编辑器中直接通过 Git 添加包（视频教程）](https://www.youtube.com/watch?v=ODL0DpEOiIE\&pp=ygUHZWRnZWdhcA%3D%3D).
{% endhint %}

<details>

<summary>高级用户可能会对以下内容感兴趣：</summary>

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

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

***

Unity： `无法解析程序集：'Edgegap.Gen2.SDK...`

* 这是由以下原因导致的已知问题 [Unity 的 Burst 编译器](https://docs.unity3d.com/6000.0/Documentation/Manual/com.unity.burst.html).
* 通过安装插件 [使用 ZIP 压缩包](https://github.com/edgegap/edgegap-unity-gen2-sdk/edit/main/README.md#install-via-zip-archive) 并删除插件文件夹中的 .asmdef 来解决此问题。

***

Visual Studio： `找不到类型或命名空间名称` 针对 Edgegap 命名空间。

1. 在 Unity 编辑器中，导航到 **Edit / Preferences / External Tools / Generate .csproj files**.
2. 确保你已启用 **Git packages**.
3. 点击 **Regenerate project files**.

</details>

## 📫 分布式中继传输库

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

[查看文档](https://docs.edgegap.com/docs/relay-transports-samples):

* 下载 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)
