-
Notifications
You must be signed in to change notification settings - Fork 62
Add timeout settings for the WebSocket and the test execution. #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
de5b694
96e1101
438ebd5
22cc678
3a5d17a
fea6e10
6b24edf
59e2891
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -213,6 +213,53 @@ MCP Unity 通过将 Unity `Library/PackedCache` 文件夹添加到您的工作 | |
node Server/build/index.js | ||
``` | ||
|
||
## 可选:设置超时 | ||
|
||
默认情况下,MCP 服务器与 WebSocket 之间的超时时间为 10 秒。 | ||
您可以根据所使用的操作系统进行更改: | ||
|
||
<details> | ||
<summary><span style="font-size: 1.1em; font-weight: bold;">Option 1: Windows OS</span></summary> | ||
|
||
1. 打开 Unity 编辑器 | ||
2. 导航至 Tools > MCP Unity > Server Window | ||
3. 将 "Request Timeout (seconds)" 值更改为所需的超时秒数 | ||
4. Unity 会将系统环境变量 UNITY_REQUEST_TIMEOUT 设置为新的超时值 | ||
5. 重启 Node.js 服务器 | ||
6. 再次点击“启动服务器”,将 Unity 编辑器 Web 套接字重新连接到 Node.js MCP 服务器 | ||
|
||
</details> | ||
|
||
<details> | ||
<summary><span style="font-size: 1.1em; font-weight: bold;">Option 2: 非Windows操作系统</span></summary> | ||
|
||
对于非Windows操作系统,需要配置两个地方: | ||
|
||
### 编辑器进程超时 | ||
|
||
1. 打开 Unity 编辑器 | ||
2. 导航至 Tools > MCP Unity > Server Window | ||
3. 将 "Request Timeout (seconds)" 值更改为所需的超时秒数 | ||
|
||
### WebSocket 超时 | ||
|
||
1. 在终端中设置 UNITY_REQUEST_TIMEOUT 环境变量 | ||
- Powershell | ||
```powershell | ||
$env:UNITY_REQUEST_TIMEOUT = "300" | ||
``` | ||
- Command Prompt/Terminal | ||
```cmd | ||
set UNITY_REQUEST_TIMEOUT=300 | ||
``` | ||
2. 重启 Node.js 服务器 | ||
3. 再次点击“启动服务器”,将 Unity 编辑器 Web 套接字重新连接到 Node.js MCP 服务器 | ||
|
||
Comment on lines
+216
to
+257
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion 统一通过编辑器界面配置超时 🧰 Tools🪛 LanguageTool[uncategorized] ~227-~227: 动词的修饰一般为‘形容词(副词)+地+动词’。您的意思是否是:新"地"超时 (wb4) |
||
</details> | ||
|
||
> [!TIP] | ||
> 您的 AI 编码 IDE(例如,Claude Desktop、Cursor IDE、Windsurf IDE)和 MCP 服务器之间的超时取决于 IDE。 | ||
|
||
## <a name="debug-server"></a>调试服务器 | ||
|
||
要调试 MCP Unity 服务器,您可以使用以下方法: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't this code run on Mac machines?
Asking as I don't have one at the moment to test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On a macOS, it behaves the same as
Process
.So, I use SerializeField to persist data when not on Windows.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can confirm it works properly on windows.
This needs to have a new solution for Mac, but that should be done in a separate PR as it was a problem present before
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!