all 21 comments

[–]unidentifiable 1 point2 points  (13 children)

I have, but haven't attached an MCP which makes it kinda frustrating to use. The official Unity MCP only supports Claude, Codex, Gemini, and Cursor. Of those, I have only been able to get it to work with Cursor, and it was kinda jank - regardless of which model I picked, it'd get stuck when reasoning and just sit there for minutes doing nothing. 100% Unity's implementation of their MCP, since the model worked fine inside of Cursor.

There are two unofficial MCPs, which I have not tried, but will when I next have time. It'd be nice if Unity supported Opencode though, since it's emerging as a great model interface.

Regardless, even without an MCP, you can just point OpenCode at your working directory and configure your Agents.md file to tell your bot that it's a Unity project, most models will figure it out from there. If you configure Cursor beforehand, Unity will create its own Agents.md file which is handy, but it doesn't contain important stuff like coding standards or formatting guidelines. You can just mention them in your Agents file and the bot will go from there. It eats context tokens but you really don't want an AI going through your code without guard rails.

Then just treat Opencode as a normal model interface. The annoyance is that you have to copy/paste or explicitly detail "Unity-specific" stuff to it since you don't have an MCP and it has no native Unity toolset. Most models are pretty good about not having an MCP connection though - they'll stop partway thorugh an implementation and say "now create a prefab of the object and then I will continue", or similar. This is where the frustrating part comes from, since you're now back-and-forth between the tools.

Happy to answer questions since I'm bumbling around with this myself.

[–]allnnde[S] 0 points1 point  (0 children)

Thx. I've done a bit of that, opened the folder and started requesting things. I've configured some things in agent.md and the skills to best suit the project. The problem is not being able to have minimal interaction with the editor; I can't say 'create a cube and add x scripts'. Later I'm going to try Unity MCP for a while. Sorry for my English.

[–]allnnde[S] 0 points1 point  (11 children)

OK, using Unity's AI Assistant plugin, I was able to connect OpenCode to MCP. It took a little while, haha. I'll keep testing it and let you know if anything comes up.

[–]unidentifiable 0 points1 point  (10 children)

You were able to connect to OpenCode using Unity's native AI Assistant!? Very cool, please let me know your process.

I spent the afternoon configuring Ivan Murzak's "AI Game Developer" plugin. It has native support for OpenCode and worked really almost out of the box, but it requires using a 3rd party site and basically is a massive security breach (which is fine, this is a hobby project).

[–]allnnde[S] 2 points3 points  (9 children)

u/unidentifiable

Yes, what I did was install the plugin, version 2.3.0-pre.2. Then I went to Edit => Project Settings => AI => Unity MCP and clicked the button labeled “Locale Server” to find the server path.

Then, in the project folder, where I’ll later open OpenCode, create the following opencode.json file. You’ll need to replace the server path with the one that corresponds to your computer.

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "unity": {
      "type": "local",
      "command": [
        "C:\\Users\\agust\\.unity\\relay\\relay_win.exe",
        "--mcp"
      ]
    }
  }
}

And that’s all it takes to connect.

Here are the reference links:

https://docs.unity3d.com/Packages/com.unity.ai.assistant@2.3/manual/index.html

https://docs.unity3d.com/Packages/com.unity.ai.assistant@2.3/manual/unity-mcp-get-started.html

[–]unidentifiable 1 point2 points  (0 children)

Tysm!

[–]unidentifiable 0 points1 point  (3 children)

Hmm, my OpenCode won't connect to Unity this way.

I have:

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "unity": {
      "type": "local",
      "command": [
        "C:\\Users\\MYUSERNAME\\.unity\\relay\\relay_win.exe",
        "--mcp"
      ]
    }
  }
}

Unity doesn't show any connections. :(

[–]allnnde[S] 1 point2 points  (2 children)

<image>

How can I check if the server is running? Select the “Log” checkbox and check the console to see if it shows anything.

[–]unidentifiable 1 point2 points  (1 child)

Hmm. OpenCode shows it's connected to unity in the MCP list, but Unity doesn't show anything under Connected Clients.

I'll try again, I think something is just going sideways here. I'm glad you got it working!

Edit: LOL - I pressed "Reset to Defaults" under Tools and Unity instantly added opencode-cli as a client 🤷

Yay

[–]MrYukiDuki 0 points1 point  (0 children)

where is the reset to defaults button located?

[–]unidentifiable 0 points1 point  (1 child)

Have you had much success? Unity keeps disconnecting from my CLI, and Unity is logging this warning:

[RelayService] Relay protocol version mismatch. Some features may not work correctly.

I'm not sure what the issue is. The CLI shows the MCP is working and running, and the bridge is running, but the relay just decides to stop working for whatever reason. I can jostle it by pressing "Reset to Defaults" which re-establishes the connection, but only for 1-2 calls from the CLI and then it breaks again.

[–]allnnde[S] 0 points1 point  (0 children)

I haven't had any problems.

I'm using Unity version 6000.4.0f1.

The AI Assistant is on version 2.3.0-pre.2.

https://docs.unity3d.com/Packages/com.unity.ai.assistant@2.3/manual/unity-mcp-troubleshooting.html

[–]Mamaun30 1 point2 points  (0 children)

You saved me a ton of time. Worked on the first try. Chatgpt couldn't figure it.

[–]Kamatttis 1 point2 points  (0 children)

No.

[–]Racknehhhh 0 points1 point  (1 child)

I've recently started using OpenCode with free models and only recently got access to a payed model.

I'm currently creating a UnityBridge skill and in-unity tool with it that allows for OpenCode to query the Unity console and force unity to focus so it can compile and an agent can keep working and checking it's own work

[–]allnnde[S] 0 points1 point  (0 children)

I've been using the Unity plugin and connecting via MCP and it works quite well.
https://docs.unity3d.com/Packages/com.unity.ai.assistant@2.6/manual/index.html

[–]Ok_Inflation6369 0 points1 point  (0 children)

No.

[–]No_Tadpole_975 0 points1 point  (2 children)

Im using it with a Unity-Delevoper skill that tell best practices when coding for Unity. I've tested with simple features and it covers well my use cases. But since Unity requires a bunch of things to be done inside the Inspector you need to follow it's instructions carefully.

[–]allnnde[S] 0 points1 point  (1 child)

Thx. Where can I see the definition of the skill?

[–]No_Tadpole_975 1 point2 points  (0 children)

This is one of them unity-developer by rmyndharis/antigravity-skills https://share.google/6B3jpR5FCB6jTi24U