# Setting Up Coplay MCP with Claude Code
Source: https://docs.coplay.dev/coplay-mcp/claude-code-guide
Learn how to install and configure the Coplay MCP server to enable Claude Code integration with Unity Editor for seamless AI-assisted development.
**Coplay MCP** (Model Context Protocol) bridges Claude Code and Unity Editor, allowing you to control Unity directly from your AI assistant. This integration enables you to create GameObjects, modify components, generate scenes, and debug your Unity projects through natural language commands.
Before starting this tutorial, ensure you have:
* Unity installed (2022 or later recommended)
* Node.js and npm installed on your system (for Claude Code)
* Python 3.11 or higher installed
* A Unity project ready for development
* Basic familiarity with command line/terminal
First, you need to install the Coplay extension inside Unity Editor.
1. Open your Unity project
2. Install the Coplay package from the Unity Package Manager with the Git URL: [https://github.com/CoplayDev/unity-plugin.git#beta](https://github.com/CoplayDev/unity-plugin.git#beta)
3. Ensure the Coplay extension is enabled and running
The Claude Code CLI is required to manage MCP server connections.
Open your terminal (PowerShell on Windows, Terminal on macOS/Linux) and run:
```bash theme={null}
npm install -g @anthropic-ai/claude-code
```
After installation, you may need to restart your terminal for the `claude` command to be recognized.
Verify the installation by running:
```bash theme={null}
claude --version
```
Now connect the Coplay MCP server to Claude Code. This enables communication between Claude and your Unity Editor.
Run the following command in your terminal:
```bash theme={null}
claude mcp add --scope user --transport stdio coplay-mcp --env MCP_TOOL_TIMEOUT=720000 -- uvx --python ">=3.11" coplay-mcp-server@latest
```
**Command Breakdown:**
* `--scope user`: Installs the server for your user account
* `--transport stdio`: Uses standard input/output for communication
* `--env MCP_TOOL_TIMEOUT=720000`: Sets a 12-minute timeout for long operations
* `uvx --python ">=3.11"`: Uses Python 3.11 or higher to run the server
Check that the Coplay MCP server is properly connected:
```bash theme={null}
claude mcp list
```
You should see output similar to:
```
coplay-mcp: ✓ Connected
```
If you see an error or the server isn't listed, try restarting your terminal and running the verification command again.
With everything installed, you can now control Unity through Claude Code:
1. **Open your Unity project** in Unity Editor
2. **Start a conversation with Claude Code** in your terminal or IDE
3. **Ask Claude to list open Unity projects:**
```text theme={null}
"List all open Unity editors"
```
Claude will now have access to your Unity project and can:
* List and navigate the scene hierarchy
* Create and modify GameObjects
* Add and configure components
* Generate materials and textures
* Set up Input Actions
* Create UI elements
* Debug and fix scripts
* And much more!
Try a simple command to test the integration:
**Prompt:**
```text theme={null}
"Create a red cube at position (0, 1, 0) in the current Unity scene"
```
Claude will:
1. Set the Unity project root
2. Create a GameObject with a Cube primitive
3. Position it at the specified coordinates
4. Create and assign a red material
Check your Unity Scene view to see the result!
If you're working with multiple Unity projects, you can explicitly set which project Claude should work with:
**Prompt:**
```text theme={null}
"Set the Unity project root to D:\Unity\MyProject"
```
This ensures all Unity commands target the correct project.
***
## 🎥 Video Tutorials
*Watch these guides to see the setup process in action:*
Step-by-step installation of the Coplay Unity package
Quick overview of getting started with Coplay
***
## 🔧 Troubleshooting
**Solution:** Ensure Node.js and npm are properly installed, then run:
```bash theme={null}
npm install -g @anthropic-ai/claude-code
```
Restart your terminal after installation.
**Solution:**
1. Verify Python 3.11+ is installed: `python --version`
2. Remove and re-add the server:
```bash theme={null}
claude mcp remove coplay-mcp
claude mcp add --scope user --transport stdio coplay-mcp --env MCP_TOOL_TIMEOUT=720000 -- uvx --python ">=3.11" coplay-mcp-server@latest
```
3. Restart Claude Code
**Solution:**
* Ensure Unity Editor is open with your project loaded
* Try explicitly setting the project root in Claude Code
* Verify the Coplay Unity package is installed and enabled
**Solution:** The default timeout is already set to 12 minutes. For even longer operations, increase the `MCP_TOOL_TIMEOUT` value:
```bash theme={null}
claude mcp remove coplay-mcp
claude mcp add --scope user --transport stdio coplay-mcp --env MCP_TOOL_TIMEOUT=1800000 -- uvx --python ">=3.11" coplay-mcp-server@latest
```
***
**Pro Tip:** Use the `@` symbol to reference specific Unity assets, scripts, or GameObjects in your prompts. For example: "Modify the **`@PlayerController.cs`** script to add jump functionality."
## Next Steps
Now that Coplay MCP is set up, explore what you can do:
* **Create GameObjects and Prefabs** with natural language
* **Generate 3D scenes** from text descriptions
* **Fix and debug scripts** by describing the issue
* **Set up Input Actions** for player controls
* **Build UI systems** with automatic layout and styling
* **Generate textures and materials** with AI
Start by asking Claude: *"What can you do with Unity through Coplay MCP?"*
# Quick Start
Source: https://docs.coplay.dev/coplay-mcp/guide
Get started with Coplay MCP in your Unity project in minutes
**Prerequisite**: Ensure you have Coplay properly installed in your Unity project before proceeding.
If you haven't installed Coplay yet, please follow our [Installation Guide](/getting-started/installation) first.
You'll need Python 3.11 or higher, and `uv` installed.
## What is Coplay MCP
Coplay MCP is an interface that lets you control Coplay inside Unity from your favorite MCP client such as Cline or Claude Code.
As an example, here's a video in which [we use Coplay's MCP to edit multiple Unity projects simultaneously](https://www.youtube.com/watch?v=lphJPLfkXN8).
## Setting up Coplay MCP
Once you have Coplay installed and authenticated, you're ready to connect the Coplay MCP.
### Claude Desktop
1. Open the Claude Desktop app.
2. Go to Settings > Developer > Edit Config.
3. Open JSON file "claude\_desktop\_config.json"
4. Add the following entry to your mcpServers list:
```json theme={null}
{
"mcpServers": {
"coplay-mcp": {
"command": "uvx",
"args": [
"--python",
">=3.11",
"coplay-mcp-server@latest"
],
"env": {
"MCP_TOOL_TIMEOUT": "720000"
}
}
}
}
```
5. Fully quit and restart Claude Desktop.
### Claude Code
Run this command:
`claude mcp add --scope user --transport stdio coplay-mcp --env MCP_TOOL_TIMEOUT=720000 -- uvx --python ">=3.11" coplay-mcp-server@latest`
Detailed steps on setting up Claude Code with Coplay MCP.
### Cursor & Cline
Add this config to your MCP host:
```json theme={null}
{
"mcpServers": {
"coplay-mcp": {
"autoApprove": [],
"disabled": false,
"timeout": 720,
"type": "stdio",
"command": "uvx",
"args": [
"--python",
">=3.11",
"coplay-mcp-server@latest"
]
}
}
}
```
### VS Code
1. Use CMD/Ctrl + Shift + P to open the Command Palette
2. Choose **MCP: Add Server**
3. Choose **stdio**
4. Enter this command: `uvx --python >=3.11 coplay-mcp-server@latest`
5. Enter `coplay-mcp` as the identifier
### Antigravity
1. Open the MCP Servers menu in the top right.
2. Select Manage MCP Servers.
3. Click View Role Config to open your mcp\_config.json file.
4. Add the following configuration to your MCP list:
```json theme={null}
{
"mcpServers": {
"coplay-mcp": {
"disabled": false,
"command": "uvx",
"args": [
"--python",
">=3.11",
"coplay-mcp-server@latest"
]
}
}
}
```
5. Save the file and click Refresh in the MCP Manager to see Coplay appear in the list.
Step-by-step installation of the Coplay MCP in Antigravity
### Testing
To test that your Coplay MCP works, prompt your MCP client (e.g., Cursor or ChatGPT) with something like: `List all of the open unity editors using Coplay MCP`. If this yields the actual list of open editors, you're good to go.
### Note
We set the timeout to 720s (12 minutes) because using the coplay\_task tool can run for quite a while in Unity depending on the task. If you don't plan to use the coplay\_task tool, you can set the timeout to a more reasonable value such as 60s.
## Example config for Codex CLI
For Codex CLI you need to edit your `~/.codex/config.toml` file to include the Coplay MCP server:
```
[mcp_servers.coplay_mcp]
command = "uvx"
args = ["--python", ">=3.11", "coplay-mcp-server@latest"]
env = { "MCP_TOOL_TIMEOUT" = "720000" }
```
Need more help? Join our [Discord community](http://discord.com/invite/KmGfEr6d3v) for support from the Coplay team and other users.
# Common Issues
Source: https://docs.coplay.dev/essentials/Common-Issues
Quick solutions for when Coplay is stuck, unresponsive, or experiencing installation errors.
While Coplay is designed to handle complex Unity tasks autonomously, you may occasionally encounter performance loops or installation errors. Use this guide to resolve common issues and get back to developing.
## 🛑 Installation & Environment Issues
### **UV Package Manager Not Found**
If you receive an error stating that the `uv` package manager is missing—even after installing it via PowerShell, winget, or pip—it is likely because your system's environment variables haven't refreshed.
* **The Solution:** Restart your PC.
* **Why it happens:** Some installers fail to propagate the new "PATH" variables to all active command-line instances and the Unity Editor. A full restart ensures that the `uv` command is globally recognized.
If you've just installed UV and Coplay still can't find it, **restart your computer** before attempting further troubleshooting. This is the most common fix for initial setup errors.
***
## 🛑 Execution Issues
### **Stuck at "Executing..."**
If the chat window stays on the "Executing..." state for more than 30–60 seconds without any changes appearing in the Unity Editor, the task may have hung.
* **Option 1: Create a New Task.** Often, a specific task gets caught in a context loop. Starting a fresh thread clears the memory and allows Coplay to try a different approach.
* **Option 2: Restart Coplay.** Close the Coplay window in Unity and re-open it via the **Window** menu.
If you are unable to open a new chat or the UI is completely unresponsive:
1. Close Unity.
2. Navigate to your project's `Packages` directory.
3. Inside the **Coplay** folder, locate the **CoplayLogs** sub directory, and delete it entirely.
4. Re-open Unity. The editor will automatically re-import the package, clearing any corrupted local state.
### **The Screenshot Loop**
Coplay occasionally takes screenshots of your Scene or Game view to verify its work. If you notice it taking the same screenshot repeatedly:
* Click the **"Stop"** button in the chat window.
* Start a new thread and refine your prompt to be more specific about the target object or property.
***
## 💡 Troubleshooting Tips
If an issue persists, click the **"Send logs"** button in the Coplay window. This allows our team to analyze data and identify if the bottleneck is network-related or a specific tool conflict.
If you encounter a "Something went wrong" message, you can often simply type **"Continue where you left off"** to prompt Coplay to resume its last task using history.
***
## 🛠 Reporting a Bug
If these steps do not resolve your issue, please provide the following details when reaching out for support:
1. **Unity Version:** (e.g., Unity 6 or 2022.3 LTS).
2. **Reproduction Steps:** What were you trying to achieve? (e.g., "Refactoring a NavMesh script").
3. **Logs:** Let us know if you have already used the "Send Logs" function.
Always ensure your Unity Editor is open and the **MCP for Unity** bridge is active (**Window > MCP for Unity**) before starting a Coplay session.
# Best Practices
Source: https://docs.coplay.dev/essentials/best-practices
How to structure your prompts for better results with Coplay
Coplay is designed to understand natural language, but structuring your requests in certain ways can help you get better and more accurate responses. This guide will help you communicate effectively with Coplay in Unity.
## Request Types
Here are the main types of requests you can make to Coplay:
### Questions
Best for when you need information or explanations.
```
"How do I implement a jump mechanic in Unity?"
"What's the difference between Update and FixedUpdate?"
"Why is my raycast not detecting collisions?"
```
Be specific with your questions. The more details you provide, the more
tailored Coplay's response will be to your situation.
### Code Generation
Ask Coplay to write code for you by clearly stating what you need.
```
"Write a script for a third-person camera controller"
"Create a health system with damage and healing functions"
"Generate a JSON parser for my save game data"
```
### Code Analysis
Share your existing code for Coplay to analyze, explain, or improve.
```
"What's wrong with this code? [paste your code]"
"Optimize this function for better performance: [paste function]"
"Explain how this script works: [paste script]"
```
## Text Formatting for Better Results
Formatting your messages can help Coplay understand your needs better.
| Technique | How to use it | Example |
| --------------- | ---------------------------------------- | ------------------------------------------------------------------------------------------------------- |
| Be specific | Include details about your goal | "Create a script that makes the camera follow the player **with smooth damping** and **height offset**" |
| Use sections | Separate different parts of your request | "**Context**: I'm making a 2D platformer. **Question**: How should I handle wall jumping?" |
| Provide context | Explain your project setup | "I'm using **Unity 2022.1** with the **URP** rendering pipeline and need help with..." |
## Effective Prompting Techniques
### Step-by-Step Instructions
When you need Coplay to help with a complex task, break it down into steps:
```
"I want to create an inventory system. First, help me design the data structure.
Once that's done, I'll ask for help implementing the UI."
```
### Iterative Refinement
Start with a basic request and then refine it based on Coplay's response:
> Initial: "Create a player movement script"
>
> Follow-up: "That's good, but can you modify it to include sprinting when the Shift key is pressed?"
## Code Examples
When sharing code with Coplay, use code blocks to make it easier to read:
```csharp theme={null}
// Ask about this code
void Update() {
if (Input.GetKeyDown(KeyCode.Space)) {
rb.AddForce(Vector3.up * jumpForce, ForceMode.Impulse);
}
}
```
## Unity-Specific Terminology
Using accurate Unity terminology helps Coplay understand exactly what you're asking:
| General Term | Unity-Specific Term |
| ------------ | ------------------------------ |
| 3D object | GameObject |
| Property | Component, Parameter, or Field |
| Screen | Scene, Game View, or UI Canvas |
| Code file | Script or MonoBehaviour |
## Mathematical Expressions
Coplay can understand mathematical expressions, which is useful for game physics and graphics questions:
F = m \times a
```
"How do I calculate the force needed to make my object jump to a height of h
using the formula F = m × a?"
```
## Sample Conversation Flow
Here's an example of an effective conversation with Coplay:
> **You**: I'm trying to make an enemy that patrols between waypoints. Can you help me with the script?
>
> **Coplay**: \[Provides basic patrol script]
>
> **You**: Thanks! Now how can I make the enemy detect and chase the player when they get close?
>
> **Coplay**: \[Builds on previous script to add player detection and chase behavior]
>
> **You**: One last thing - how do I make the enemy return to patrolling when it loses sight of the player?
>
> **Coplay**: \[Completes the AI behavior with returning to patrol functionality]
## Workflow Strategies
### Be Iterative
Don't try to accomplish everything in one large request. Break down your needs into smaller, manageable chunks:
```
"First, help me create a basic player controller"
→ "Now add jumping functionality to the controller"
→ "Finally, add wall-jumping mechanics"
```
### Choose the Right Mode
**Agent Mode** is ideal for straightforward, focused tasks:
```
"Fix this compilation error in my script"
"Add a health bar to my UI"
"Create a simple pickup system"
```
**Normal Mode** works better for open-ended, exploratory requests:
```
"I want to design a combat system for my RPG - what are some approaches?"
"Help me brainstorm mechanics for a puzzle platformer"
"What's the best way to structure my game's architecture?"
```
### Communication Tips
**Don't hesitate to interrupt Coplay** if it's going in the wrong direction:
> "Stop - that's not what I need. Let me clarify..."
**Be direct when you're not satisfied:**
```
"This isn't working for me. I need a simpler solution."
"The code you provided is too complex. Can you make it more basic?"
"I'm looking for something different - here's what I actually want..."
```
### Start Fresh for New Tasks
**Use a new conversation for each major task** to avoid context confusion:
* ✅ New conversation: "Create an inventory system"
* ✅ New conversation: "Debug my movement script"
* ❌ Same conversation: Mixing inventory questions with movement debugging
### Model Selection Strategy
**Experiment with different models** based on your task:
```
Simple tasks → Lighter models (faster, less overthinking)
Complex debugging → Thinking models (more thorough analysis)
Creative brainstorming → Balanced models
```
**For open-ended requests, ask for a plan first:**
> "Before you start coding, can you outline your approach to building this inventory system?"
### Avoiding Over-Engineering
**Coplay can overthink like humans.** For simple tasks:
```
❌ "Create a comprehensive, scalable, enterprise-grade player movement system"
✅ "Create a basic player movement script with WASD controls"
```
**Match the model to the task complexity:**
* **First implementation**: Use simpler models to avoid over-building
* **Debugging/Optimization**: Use thinking models for thorough analysis
* **Refactoring**: Thinking models excel at understanding complex codebases
### Prompt Enhancement
**Pre-process and enrich your prompts** with context:
```
Instead of: "Make a shooting script"
Try: "Create a shooting script for a 2D side-scroller where:
- Player shoots with left mouse click
- Bullets are instantiated prefabs
- Maximum 3 bullets on screen at once
- Bullets destroy after 2 seconds"
```
### Supercharge with MCP Servers
**Use MCP servers to enhance your workflow:**
```
"Use the Blender MCP server to import this model and set up the animations"
"Connect to the Git MCP server to manage version control for my project"
"Use the file system MCP server to organize my project assets"
```
> MCP (Model Context Protocol) servers provide specialized tools that can extend Coplay's capabilities beyond Unity development.
## Join Our Community
For more tips on effectively using Coplay, join our [Discord community](http://discord.com/invite/KmGfEr6d3v) where you can share your experiences and learn from other users.
# Configuration
Source: https://docs.coplay.dev/essentials/configuration
Use Coplay's advanced configuration to tailor your experience
Coplay integrates seamlessly with Unity through an intuitive interface designed to enhance your game development workflow. This guide explains all the UI elements you'll encounter when using Coplay.
## Context
The Context dropdown determines what information Coplay has access to when responding to your queries:
* **File Tree**: Provides access to your project's file structure
* **Project Settings**: Gives context about your Unity project configuration
* **Active Scene**: Includes information about the currently open scene
* **Git History**: Provides access to version control information
* **Packages**: Shows information about installed packages
**Example usage**: Select "Active Scene" when asking Coplay to help optimize
game objects in your current scene, or select "Project Settings" when
troubleshooting configuration issues.
## Mode
Coplay offers several modes that control how tasks are processed. Modes change often, so check the Discord release notes for up‑to‑date best practices. The available modes are:
* **Normal** (default) – Balanced performance that automatically executes a sequence of actions. Suitable for most tasks.
* **PipelineRecording** – Records every action in a session so you can replay the sequence or generate variations later. After recording, ask Coplay to "create a variation" to automatically apply changes based on the recorded pipeline.
* **Orchestrator** – Reads tasks from a `CoplayPlan.md` file and executes them in order. This autopilot mode aims to transform a design document into a working game. It is powerful but still experimental and may take longer to complete tasks.
When in doubt, start with **Normal** mode and adjust based on your use case.
## Model
Coplay lets you choose between the latest AI models from major foundational providers like OpenAI, Anthropic, Google, and X.AI. Each model offers distinct advantages for different Unity development tasks:
#### Anthropic
* **claude-3-7-sonnet**: (Default) Balanced model with exceptional reasoning capabilities; excellent for complex architectural decisions, debugging logic errors, and explaining game mechanics with detailed, well-structured responses. More thorough but slower, taking a step-by-step approach to problem solving.
* **claude-3-7-thinking**: Advanced reasoning model with enhanced step-by-step thinking capabilities, ideal for complex problem-solving tasks and detailed analysis of Unity systems. Excels at iterative thought processes.
* **claude-4-sonnet**: Newer general model with improved performance and understanding; offering superior code generation and architectural guidance for Unity projects. Excellent for coding tasks but slower in tool execution.
* **claude-4-thinking**: Advanced reasoning variant of Claude-4 with enhanced analytical capabilities, perfect for complex debugging and system design challenges that require thorough, methodical analysis.
### Inception
* **mercury-coder-small**: Experimental model that uses diffusion-based inference to generate code incrementally,
resulting in significantly faster execution of sequential programming tasks.
* **mercury-coder-small-stream**: Streaming variant that leverages diffusion techniques to provide real-time
response capabilities with enhanced speed benefits.
#### OpenAI
* **gpt-4.1**: Handles tasks in bulk and excels at UI development, image processing, and multiple tool execution. Can work quickly but may perform less well with complex coding tasks. Best for UI-focused work and batch operations.
* **o3**: Fast, cost-effective model for straightforward development tasks, good for quick syntax questions, simple script generation, and basic Unity workflow assistance during prototyping phases.
* **o4-mini**: Optimized for quick responses with good balance of speed and capability, effective for common Unity tasks like component setup, basic animations, and UI scripting with concise, practical answers.
### X.AI
* **grok-3**: Excels at creative problem-solving and unconventional solutions.
### Google
* **gemini-3-pro**: Strong multimodal capabilities that excels at analyzing visual elements, scene composition, and asset organization. Good with well-structured, multi-step requests and can handle actions in bulk. Offers a balanced approach between Claude Opus thoroughness and GPT-5.2's speed.
* **gemini-3-flash**: Optimized for speed and efficiency with good baseline understanding of Unity concepts, ideal for quick reference questions, syntax checking, and basic troubleshooting when immediate guidance is needed.
## Action Recording
Coplay can record your actions in the Unity Editor, allowing you to:
1. Track movements and changes to game objects
2. Delete specific recorded actions using the "×" button
3. Clear all recorded actions at once
4. Save recordings for future reference
When you've finished recording actions, you can save them with a custom name and use them for additional context in future tasks.
**Example usage**: Record a sequence of object placements to document your
level design process, then ask Coplay to analyze the pattern or suggest
improvements.
## Memory (configurability coming soon...)
Long-term memory is currently stored server side, we will soon release support for listing and continuing prior conversations
# Modes Overview
Source: https://docs.coplay.dev/essentials/modes
Understand the six operational modes that dictate Coplay's speed, interaction style, and execution scope within your Unity project.
The power of Coplay comes from its ability to adapt its execution style to your task. By selecting the appropriate mode, you instruct the AI on whether to prioritize speed, safety, automation, or deep project analysis.
## ⚙️ Execution Modes
| Mode | Purpose | Best For |
| :-------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------------- |
| **Normal** | **Standard Operation.** The default setting that automatically executes a sequence of actions with balanced performance. | Quick tasks, simple code requests, and general generation where immediate execution is desired. |
| **PipelineRecording** | **Workflow Automation.** Records a sequence of user actions in the Unity Editor so you can replay the sequence or generate variations later. | Automating highly repetitive setup tasks and creating consistent templates for asset configuration. |
| **Orchestrator** | **Design Document Automation.** An "autopilot" mode that reads tasks from a `CoplayPlan.md` file and executes them in order, aiming to transform a design document into a working game. | Executing long, multi-step tasks defined in a single game design document. |
***
### Key Workflow Tip
For tasks that are complex but manageable, start in **Normal** mode. If the task is critical or fails, switch to **StepByStep** mode to debug the AI's logic flow.
# Settings
Source: https://docs.coplay.dev/essentials/settings
Customizing and configuring your Coplay experience in Unity
### Anthropic API Key
To use Coplay with Anthropic's AI models, you need to provide your API key.
This key is essential for authenticating your requests to the Anthropic API.
### Key settings
* **Coplay User**: Your account email address
* **Device ID**: Unique identifier for your installation device
* **Highlight Changes**: When enabled, Coplay will highlight changes it makes to your projects
* **Enable Autocomplete**: Activates AI-powered code completion as you type
* **Max Requests**: The number of requests Coplay will make automonously before prompting you for confirmation
### Custom Coplay Rules
You can also manage custom rules through the "Edit Custom Coplay Rules" button,
which opens a dialog enabling you to create specialized instructions for Coplay
that will be saved to `.coplayrules.md` in your project root folder.
This will cause Coplay to include this as additional context before it takes any action
**Example usage**: Create custom rules like "Always comment public methods" or "Follow our team's naming convention" to ensure Coplay adheres to your project standards.
You can also reference other files if you have pre-existing instructions / best practices: "Before any task is started, read handovernotes.md to understand the dependencies and context of the project you are working on."
### MCP Servers
Coplay supports the Model Context Protocol (MCP) for advanced AI interactions.
You can configure multiple MCP servers to extend Coplay's capabilities, such as integrating with Blender for 3D asset generation.
Click the "Edit MCP Servers" button in the settings panel to manage your MCP server configurations.
For an example of how to set up a Blender MCP server, see our [Blender MCP tutorial](/tutorials/blender-mcp).
```json theme={null}
{
"mcpServers": {
"blender-mcp": {
"command": "uvx",
"args": [
"blender-mcp"
],
"env": {
"PATH": "/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
}
}
}
}
```
### External Documentation and Web Search
If Coplay is unfamiliar with a framework or API you’re using, you can provide it with the necessary documentation and instruct it to consult those resources when performing tasks. There are two ways to do this:
* **Download and include docs in your project**: Save the official documentation (e.g., for Meta SDK or Unity 6.2 input) into a folder under your project (for example `Docs/third-party/meta-sdk`). Then reference these files in your `.coplayrules.md` file so the model will read them before executing tasks. After editing `.coplayrules.md`, start a new chat thread to ensure the changes are loaded.
* **Use the built‑in web search**: Coplay version 4.3.0 and later can search the web to find documentation when needed. In your prompts you can instruct Coplay to search a resource (e.g., "search meta XR docs") and it will retrieve the relevant docs on the fly. This feature complements local docs and can be particularly helpful when you don’t have the documentation downloaded.
Notes: Coplay already has access to Unity documentation for the version you’re using, so you generally don’t need to provide it manually, but you can ask it to consult Unity docs explicitly if you wish. When using new features like web search or external docs, refer to the release notes in Discord for the latest guidance.
# Troubleshooting
Source: https://docs.coplay.dev/essentials/troubleshooting
How to get the most out of Coplay in Unity
Nobody's perfect and neither is AI. In this guide, we'll discuss issues you may encounter while using Coplay.
## Something went wrong
When using Coplay, you may get this error message in the chat window:
```
Something went wrong. Please try again later.
```
This is a generic error message that can occur for various reasons, such as network issues or server problems.
If you encounter this error, either clear the chat window by starting a new conversation and try again or,
if you're running a long-running task with the chat history as useful context, simply type "Continue where you left off".
Coplay will use the existing history to understand what needs to be done next and continue generating the response.
## Screenshot Loop
Coplay is a perfectionist and will keep working on a task until it is satisfied with the result. To check its work, Coplay will
occasionally take screenshots of the Scene or Game view to ensure that the changes are being applied correctly.
This can sometimes lead to a situation where Coplay is stuck in a loop, taking screenshots of the same view over and over again,
with only minimal changes in between. If you notice this happening, you can stop the task by clicking the "Stop" button in the chat window.
This will interrupt Coplay's current task and allow you to start a new one.
## Compilation Errors
When writing code, Coplay may generate scripts in an unexpected order, which can cause compilation errors due to missing references.
Coplay will typically fix these errors automatically by continuing to generate code until the project compiles successfully.
If Coplay has stopped running and you see compiliation errors, you can tell Coplay to fix them by starting a new conversation and typing:
```
Fix the compilation errors in my project
```
# Welcome to Coplay
Source: https://docs.coplay.dev/getting-started/index
The AI Assistant for Unity Game Development
Coplay is a powerful AI assistant designed specifically for Unity game developers.
It integrates directly into your Unity Editor, providing intelligent
assistance to enhance your game development workflow and productivity.
Analyze your current scene and provide suggestions for optimization and
improvements.
Quickly access Unity documentation and best practices without leaving the
editor.
Generate code snippets and entire scripts tailored to your project's needs.
Get explanations of Unity concepts and techniques as you work.
Use Coplay's built-in Action Recorder to teach Coplay how to do specific
tasks according to your preferences.
Leverage outside tools such as Meshy, Blender, and more to supercharge your
workflow even further.
## Join our Community
Everything you need to know about Coplay is right here in our documentation. But if you
have any questions or need help or just want to see what other people are building with Coplay,
we invite you to join our community on [Discord](http://discord.com/invite/KmGfEr6d3v).
We also have [YouTube Tutorials](https://www.youtube.com/@coplay-ai) on how to use Unity and Coplay for creating games.
## Getting Started with Coplay
Getting Coplay up and running in your Unity project is quick and easy. Follow our
installation guide to get started in just a few minutes.
Learn how to install Coplay directly in your Unity Editor
Connect with other Coplay users and get support from our team
# Installation
Source: https://docs.coplay.dev/getting-started/installation
Get started with Coplay in your Unity project in minutes.
## Installing Coplay
Follow these simple steps to install Coplay in your Unity Editor and start enhancing your game development workflow.
Before installing Coplay, ensure you have:
* [Unity Editor](https://unity.com/download) installed on your machine
* Installation Instructions: [https://learn.unity.com/tutorial/install-the-unity-hub-and-editor](https://learn.unity.com/tutorial/install-the-unity-hub-and-editor)
* Git installed *(required for package installation)*
* Installation Instructions: [https://github.com/git-guides/install-git](https://github.com/git-guides/install-git)
* If you're on Windows and new to Git, see this video for Git installation help: [https://youtu.be/lt9oDAvpG4I?si=ChspIYB4sWQjmChh](https://youtu.be/lt9oDAvpG4I?si=ChspIYB4sWQjmChh)
* An active internet connection
1. Open your Unity project
2. Go to **Window > Package Manager** in the Unity Editor menu
3. Click the **+** icon in the top-left corner of the Package Manager window
4. Select **Add package from git URL...**
5. Paste the appropriate installation URL according to your Unity version:
**For Unity 2022 and above:**
```
https://github.com/CoplayDev/coplay-unity-plugin.git#beta
```
**For Unity 2021** (A few UI warnings will be logged that can be safely ignored):
```
https://github.com/CoplayDev/coplay-unity-plugin.git#beta-unity-2021
```
Note: Unity 2021 and lower is not part of our long-term support plan and there might be some unknown bugs in Unity 2021.
6. Click **Add** and wait for the installation to complete (this may take a
minute)
If you run into any issues, join our reach out in our [Discord](https://discord.gg/y4p8KfzrN4) and we'll help you get set up.
# Prompt Cost Guide
Source: https://docs.coplay.dev/getting-started/promptcost
Average prompt costs for Coplay users across GPT-5, Claude 4.5, and Gemini 3.
Coplay supports **Bring Your Own Key (BYOK)**. The data below represents the average cost of a single interaction (prompt + response) based on real-world usage metrics.
***
## 🏷️ Live Price List (Avg. Cost Per Prompt)
### 🟢 OpenAI Models
The industry standard for professional task reliability and tool-calling precision.
| Model | Avg. Cost / Prompt | Best Use Case |
| :-------------------- | :----------------- | :---------------------------------------------------- |
| **GPT-5.2** | **\$0.032** | **The Expert.** High-stakes professional logic. |
| **GPT-5.1** | **\$0.031** | **The Workhorse.** High-throughput reasoning. |
| **GPT-5.1 Codex** | **\$0.030** | **Logic King.** Best for complex C# architecture. |
| **GPT-5.1 Codex Max** | **\$0.023** | **Deep Context.** Large file processing/scanning. |
| **GPT-4.1** | **\$0.035** | **Legacy Logic.** Stable but higher avg. cost/prompt. |
### 🟣 Anthropic (Claude)
The leader in coding capabilities, particularly for "agentic" and multi-file workflows.
| Model | Avg. Cost / Prompt | Best Use Case |
| :-------------------- | :----------------- | :----------------------------------------------------------- |
| **Claude 4.5 Opus** | **\$0.110** | **The Architect.** Unrivaled multi-file refactors. |
| **Claude 4.5 Sonnet** | **\$0.100** | **The Gold Standard.** Favorite for Unity devs. |
| **Claude 4.5 Haiku** | **\$0.025** | **Speed Specialist.** Fast edits and sub-tasks. |
| **Claude 3.7 Sonnet** | **\$0.026** | **Hybrid Reasoning.** Produced in standard or thinking mode. |
| **Claude 3.5 Sonnet** | **\$0.082** | **Legacy.** Maintained for project consistency. |
### 🔵 Google & Specialized Models
Gemini 3 Pro is optimized for massive 1M+ token windows.
| Model | Avg. Cost / Prompt | Best Use Case |
| :------------------ | :----------------- | :---------------------------------------------- |
| **Gemini 3 Pro** | **\$0.140** | **Context Beast.** Massive codebase ingestion. |
| **Gemini 2.5 Pro** | **\$0.062** | **Large Memory.** Reliable wide-context tasks. |
| **Nova Premier VL** | **\$0.083** | **Multimodal.** Advanced video/image logic. |
| **Jamba Large 1.7** | **\$0.065** | **High Throughput.** Optimized for low-latency. |
***
## 💰 Critical Billing Rules
**The 5-Minute Cache Window:** Anthropic and Google prices drop significantly when context is cached. However, if you wait more than **5 minutes** between replies, the cache expires, and you are billed the full price for your history again.
### 📉 Efficiency Strategies
**Unpin files** (`@`) as soon as you are done with them. Every pinned file adds to the input cost of *every* message in that thread.
Once a thread exceeds **200,000 tokens**, providers often implement a surcharge. When you hit this threshold, **Start a New Thread**.
Use **Gemini 3 Pro** for deep codebase research, but switch to **Claude 4.5 Haiku** or **GPT-5.1** for writing individual methods to keep your costs low.
# Prompt Guide
Source: https://docs.coplay.dev/getting-started/promptguide
Master the art of contextual prompting to receive precise, actionable results from Coplay, every time.
Effective communication is key to efficiency. By organizing your requests using a clear framework, you eliminate guesswork for **Coplay** and ensure the output—be it code, refactoring, or scene analysis—is always ready to use in your Unity project.
## The Optimal Prompt Formula
Every high-quality **Coplay** prompt should contain these three components:
### **1. Initial State (The Context)**
Define where you are starting. Include the necessary background, the existing issue, or the component you plan to modify.
> **Example:** "I have a third-person camera system using Cinemachine. The shake on impact is jarring."
### **2. Desired Outcome (The Goal)**
State exactly what you want the AI to deliver. Be specific about the functionality and the performance criteria.
> **Example:** "Refactor the camera script to smoothly ramp up and then immediately decay the shake effect over 0.75 seconds to feel more natural."
### **3. Response Specifications (The Format)**
Tell **Coplay** where the change should happen and how the output should be structured.
> **Example:** "Provide the full C# script for **`@CameraControl.cs`** with the new logic, ensuring all public fields are serialized."
A great prompt is always focused: **What is happening?** ➡️ **What should happen?** ➡️ **Where should it go?**
## Ensuring Project Focus
**Coplay** is project-aware, but you must direct its attention. Always reference specific files or objects to ensure the AI uses the correct context from your Unity project.
### **Always Reference Assets**
Avoid generalized language. Use file pinning (like the `@` symbol) or the in-editor selection tools to ensure **Coplay** is working on the correct scripts, prefabs, or scenes.
> **Effective:** "Please update the `PlayerAttack()` function inside **`@MeleeCombatSystem.cs`** to..." **Ineffective:** "Fix the player's attack script..."
Asking **Coplay** to perform tasks like "Fix all compilation errors" will yield poor results. Be precise: "Address the specific type error in the **`@HealthBarUI.cs`** script."
***
## Dealing with Subpar Outputs
If **Coplay** generates an incorrect or incomplete response, resist the urge to debug it conversationally within the same thread. Since you cannot edit past prompts, this only creates confusion.
### **Know When to Reset**
If the AI misunderstands the core objective after the first attempt, it is always the most efficient choice to **Start a New Thread**.
* A clean start ensures the model is not polluted by the failed attempts and has a fresh contextual memory for your request.
* When starting the new thread, you may need to **re-pin your assets** and provide richer **Initial State** context to guide the AI correctly this time.
**NEVER** attempt to debug or fix a massive, incorrect AI output by conversationally pointing out dozens of errors. **Start a New Thread instead.**
# Quickstart
Source: https://docs.coplay.dev/getting-started/quickstart
Get started with Coplay in your Unity project in minutes
**Prerequisite**: Ensure you have Coplay properly installed in your Unity project before proceeding.
If you haven't installed Coplay yet, please follow our [Installation Guide](/getting-started/installation) first.
## Getting Started with Coplay
Once you have Coplay installed and authenticated, you're ready to start using it to enhance your Unity development workflow.
**Step 1**: Open Coplay in Unity:
```text Mac theme={null}
Command + G
```
```text Windows theme={null}
Control + G
```
**Step 2:** Choose your Coplay settings, including your Mode, Model, and Context availability. For more information on available settings, visit the [Settings](/essentials/settings) page.
**Step 3**: Start interacting with Coplay by typing in your questions or commands in the chat panel.
```csharp theme={null}
// Ask Coplay about Unity concepts like:
"How do I implement a character controller in Unity?"
```
```csharp theme={null}
// Or get specific code help:
"Write a script to make my camera follow the player with smooth damping"
```
```csharp theme={null}
// Debug existing code:
"Why is my collision detection not working properly?"
```
By default, Coplay will only provide suggestions and instructions of how to implement these changes in Unity.
For Coplay to act on your befalf, check "Auto-Approve" and Coplay will proceed uninterrupted as it generates actions in your project.
### Tips for Effective Usage
1. **Context-Aware Queries**: Always select the appropriate context for your question to get the most relevant answers
2. **Mode Switching**: Change agent modes based on your current development focus
3. **Model Selection**: Use faster models for simple tasks and more advanced models for complex problems
4. **Action Recording**: Use action recording to document processes that you want to analyze or replicate later
5. **Custom Rules**: Set up custom rules to ensure Coplay aligns with your team's development standards
For more detailed information on configuring Coplay's behavior, see the [Configuration Guide](/essentials/configuration).
Need more help? Join our [Discord community](http://discord.com/invite/KmGfEr6d3v) for support from the Coplay team and other users.
# Creating UI with Coplay
Source: https://docs.coplay.dev/tutorials/Creating-UI
Learn how to use Coplay to design complex UI windows, manage prefabs, and maintain visual consistency across your Unity project.
Building user interfaces in Unity often involves navigating deeply nested menus. **Coplay** simplifies this by allowing you to generate entire UI windows from natural language, automatically hook up logic, and ensure new elements match your existing project style.
Before starting this tutorial, ensure you have:
* Unity installed with the Coplay extension.
* The **Active Scene** and **File Tree** context enabled in your Coplay settings.
* A basic understanding of Unity's UGUI or UI Toolkit.
Instead of a vague request like "Make a menu," provide a structural prompt. This helps Coplay understand the hierarchy of the window you want to build.
**Example Prompt:**
```text theme={null}
"Create a complex Settings window as a Canvas. Include a background panel and three child tabs for 'Audio', 'Graphics', and 'Controls'. Ensure all buttons use a Vertical Layout Group for organization."
```
To ensure your new UI doesn't look out of place, use Coplay to analyze your existing assets.
1. **Pin your source:** Use the `@` symbol to reference an existing UI Prefab.
2. **Prompt for matching:** "Create a new 'Level Up' popup that matches the button styles, fonts, and color palette of **`@MainHUD_Prefab`**."
Advanced models like GPT-5 can analyze existing styles and replicate them perfectly across new prefabs.
AI-generated UI is most useful when it's reusable. Once you are happy with a layout, instruct Coplay to save it.
**Prompt:**
```text theme={null}
"This looks perfect. Now, save this entire Settings window as a Prefab in the 'Assets/Prefabs/UI' folder."
```
After the visual elements are in place, bridge the gap to your game code.
* **Example:** "Reference the **`@UIManager.cs`** script and hook up the 'Back' button's `OnClick` event to the `CloseCurrentWindow()` method."
As your UI becomes more complex, the AI can experience "context rot" over long sessions.
**The Workflow Fix:** - Once a specific window is built and saved as a prefab, **Start a New Thread**.
* This clears out the old "designing" noise and gives the AI a fresh head-start for the next task, such as coding the data-binding or animations.
***
## 🎥 Video Tutorials
*Check out these walkthroughs to see these workflows in action:*
Learn how to create and save complex windows from an image.
Connecting buttons to C# methods with AI (Coming Soon).
**Pro Tip:** For high-stakes UI work, use **StepByStep Mode**. It allows you to approve each layout group adjustment before the AI proceeds, preventing messy hierarchies.
# Generate Blender Assets
Source: https://docs.coplay.dev/tutorials/blender-mcp
Learn how to use Coplay to create 3D assets using Blender and import them into Unity
This guide will walk you through how to connect Coplay to Blender using the Model Context Protocol (MCP),
create 3D assets directly from natural language prompts, and seamlessly import them into your Unity projects.
Before starting this tutorial, ensure you have:
* Unity installed with Coplay extension
* Python and pip installed on your system
* uv package manager installed (we'll install this if needed)
* Basic familiarity with Unity and 3D modeling concepts
1. **Download Blender**: Visit [blender.org](https://www.blender.org/download/) and download the latest version for your operating system
2. **Install Blender**: Follow the standard installation process for your platform
3. **Launch Blender**: Start Blender to ensure it's working correctly
Make sure you're using Blender 3.0 or later for compatibility with the MCP server.
The Blender MCP server requires the `uv` package manager for Python dependency management.
**On macOS (using Homebrew):**
```bash theme={null}
brew install uv
```
**On other platforms:**
```bash theme={null}
curl -LsSf https://astral.sh/uv/install.sh | sh
```
**Verify installation:**
```bash theme={null}
uv --version
```
The Blender MCP server enables communication between Coplay and Blender through the Model Context Protocol.
1. **Install using uv:**
```bash theme={null}
uvx blender-mcp
```
2. **Verify the installation:**
```bash theme={null}
uvx blender-mcp --help
```
The Blender MCP server is based on [ahujasid/blender-mcp](https://github.com/ahujasid/blender-mcp) repository,
which provides a bridge between AI language models and Blender's Python API.
Start Blender and navigate to Edit > Preferences > Add-ons. Select "Install from Disk ..."
and choose the `addon.py` file from the `blender-mcp` directory you just installed.
Enable the add-on by checking the box next to it.
By default, the MCP server will listen on port 9876.
If you need to change this, you should also modify the `addon.py` configuration file.
Once configured, you should see the Blender MCP server connection active in Coplay.
The MCP server provides several tools for Blender automation:
* **Scene creation and manipulation**
* **Object modeling and sculpting**
* **Material and texture application**
* **Lighting and camera setup**
* **Asset export functionality**
Now we need to configure Coplay to connect to the Blender MCP server.
1. **Open Coplay Settings**: In Unity, go to **Coplay > Toggle Window** or press `⌘ + G` (Mac) / `Ctrl + G` (PC)
2. **Access MCP Configuration**: Click the "Edit MCP Servers" button in the Coplay settings panel
3. **Add Blender MCP Server**: Add the following configuration to your MCP servers:
```json theme={null}
{
"mcpServers": {
"blender-mcp": {
"command": "uvx",
"args": [
"blender-mcp"
],
"env": {
"PATH": "/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
}
}
}
}
```
Update the PATH environment variable to match where `uv` is installed on your system. The example above shows the typical path for Homebrew installations on macOS.
4. **Save and Restart**: Save the configuration and restart Coplay to establish the MCP connection
Now for the exciting part! Let's create a beautiful 3D scene using natural language.
**Use this prompt in Coplay:**
```
Using Blender via MCP, create a low-poly cherry blossom garden.
The scene should include:
- Several cherry blossom trees with pink flowers
- A garden path cuttng through the trees
- Some decorative stones areas
- Low-poly aesthetic for game-ready assets
Please organize the scene with proper materials and ensure all objects are named appropriately for Unity import.
```
Coplay will interpret this prompt and use the Blender MCP server to automatically create geometry, apply materials, set up lighting, and organize the scene structure.
As Coplay works with Blender through MCP, Coplay will provide status updates as it creates objects. Watch as Blender automatically creates your scene
**What Coplay will do:**
* Create base meshes for trees, paths, and landscape elements
* Apply appropriate materials and textures
* Set up lighting to enhance the garden atmosphere
* Organize objects into logical collections
* Prepare the scene for export
Once the initial creation is complete:
1. **Open Blender**: Switch to the Blender window to see your generated scene
2. **Review the Assets**: Examine the created geometry, materials, and lighting
3. **Make Adjustments**: Use Coplay to request modifications if needed
**Example refinement prompts:**
```
"Add more detail to the cherry blossom petals"
"Make the garden path more curved and organic"
"Adjust the lighting to be more golden hour"
"Add small decorative lanterns along the path"
```
You can iterate on your scene by providing additional prompts to Coplay, which will continue to modify the Blender scene through MCP.
Now let's bring your Blender creation into Unity using Coplay.
**Use this prompt:**
```
Import the blender scene into Unity
```
Coplay will handle the entire import process, including:
* File format conversion
* Material translation
* Texture mapping
* Scene hierarchy setup
You should now have a beautiful cherry blossom garden in both Blender and Unity!
Take your 3D asset creation to the next level with these advanced techniques:
### Using Poly Haven Assets
Enhance your scenes with high-quality, free assets from Poly Haven:
```
"Using Blender MCP, download and integrate HDRIs from Poly Haven for realistic lighting in my cherry blossom garden. Add some rock textures and natural ground materials."
```
### Procedural Generation with Rodin
Generate unique 3D models using Rodin AI:
```
"Using Rodin via MCP, generate a traditional Japanese stone lantern model and integrate it into my Blender cherry blossom scene. Make it low-poly and game-ready."
```
### Dynamic Asset Variations
Create multiple variations of your assets:
```
"Create 5 different variations of cherry blossom trees with varying heights, branch patterns, and flower density. Ensure each has a unique silhouette for visual variety."
```
### Seasonal Adaptations
Transform your scene for different seasons:
```
"Adapt my cherry blossom garden for autumn - change the tree materials to orange and red leaves, add fallen leaves on the ground, and adjust lighting for a warmer, more golden atmosphere."
```
To get the most out of Blender MCP integration:
**Optimization Tips:**
* Always specify "low-poly" or "game-ready" in your prompts for Unity projects
**Organization Tips:**
* Request proper naming conventions for easy identification
* Ask for logical collection organization in Blender
* Specify material naming that makes sense for your project
**Workflow Tips:**
* Start with simple scenes and gradually add complexity
* Use iterative prompts to refine specific elements
* Save your Blender files regularly during the creation process
**Troubleshooting:**
* If MCP connection fails, check your PATH environment variable
* Ensure Blender is closed when starting the MCP server
* Ensure the MCP server is running on the 9876 port
* Verify uv installation if you encounter Python-related errors
***
Congratulations! You have successfully created a stunning cherry blossom garden using Coplay and Blender MCP.
With this foundation, you can tackle any 3D modeling challenge by simply describing what you want to create.
**Share your creations with the [Coplay community on Discord](http://discord.com/invite/KmGfEr6d3v) and inspire others with your AI-generated 3D artwork!**
# Build a Chess Game
Source: https://docs.coplay.dev/tutorials/chess
Learn how to create a chess game in Unity using Coplay
This guide will walk you through the process of setting up the game board,
creating chess pieces, and implementing basic game logic, including an AI
opponent that can play against you.
To go through this tutorial, you should have the following:
* A new Unity project with Coplay installed.
When making a new project, make sure to select the **3D Built-In Render Pipeline** template as this tutorial uses assets build with
that rendering pipeline. This is required for the chess assets you'll be using. You can use the HDRP or URP templates, but you will
need to adjust the materials and shaders accordingly.
* If you haven't installed Coplay yet, follow the [installation
guide](https://docs.coplay.dev/getting-started/installation)
* A Unity Asset Store with this [free chess asset
pack](https://assetstore.unity.com/packages/3d/props/chess-pieces-board-70092)
added (trust us, it's easier than creating your own chess pieces):
* Open the Coplay settings window by going to **Coplay > Toggle Window** in
the Unity menu or pressing `⌘ + G` or `CTRL + G` depending on whether you're
on Mac or PC.
* Make sure the **Auto-approve** option is checked.
* Set the **Model** to `claude-4-sonnet` (feel free to play around
with other models -- we have generally found the best performance with this one).
* Download the chess asset pack from the Unity Asset Store.
* Navigate to `Window > My Assets` and import the downloaded package into your Unity project.
* You should now see a folder named `Chess Pieces` in your project window.
Make sure to uncheck the `Blender.zip` and `Chess Demo.Unity` files when importing the package,
as they are not needed for this tutorial.
This is the fun part. Use the prompt below as a starting point
but feel free to modify it to your liking once you have a working game.
This prompt is going to change the following:
* Each game piece controlling possible actions
* A game manager that initializes the board with appropriate layout and manages game state
* Mouse input controller using Unity's Input System with raycast detection for piece selection,
* AI opponent with minimax algorithm and adjustable difficulty levels.
```md Prompt Instructions theme={null}
## Goal
Create a chess game using assets from `Assets/Chess Set` directory.
## Development Plan
### 1. Piece Scripts (`Scripts/Pieces/`)
- Create individual scripts for each chess piece type (Pawn, Rook, Knight, Bishop, Queen, King)
- Each script controls movement rules and logic for that piece type
- Use inheritance with a base `ChessPiece` class for common functionality
### 2. Game Manager Script and Component
- Create `GameManager.cs` to handle core game logic
- Initialize board with pieces in starting positions using:
- Prefabs from `Assets/Chess Set/Prefabs/`
- Scripts from `Scripts/Pieces/`
- Assign the prefabs via the Inspector
- Manage turn system and game state
### 3. Mouse Input Controller Script and Component
- Use the new Unity Input System
- Use raycast to detect piece/square selection
- Visual feedback for selected pieces and valid moves
- Deselection logic (same piece click or empty square)
- Clicking on a valid square moves the piece to that square
- Change piece material to indicate selection
- Add highlight effect to valid move squares
### 4. AI Opponent Script and Component
- Create AI script that makes legal moves
- Implement basic chess strategies
- Include adjustable difficulty levels as script variables
- Use minimax algorithm or similar for move selection
- Use raycasting to detect piece collision.
- The AI should collide with opposing pieces to take them whenever possible.
- IMPORTANT: If a king piece is captured, the game should end immediately.
## Technical Requirements
### Camera Setup
- Position camera x = 0, y = 40, z = -40
- Set camera rotation to 50 degrees for optimal board view
### Piece Positioning
**Important**:
- Calculate piece positions using board square count and Chess Board Play Surface dimensions
- The Chess Board Play Surface of the board is 48x48 units and there are 64 squares, so each square is 6x6 units.
- **Rotations**:
- All pieces: X-axis = -90° (face upward)
- White pieces: Y-axis = -90°
- Black pieces: Y-axis = 90°
- Chess Board: X-axis = -90° (face upward)
- IMPORTANT: Set Y position = 1 for pawns
- IMPORTANT: Set Y position = 0 for all other pieces
- IMPORTANT: Add box colliders to all pieces with size X = 0.035 Y = 0.03 Z = 0.05
### Best Practices
- Initialize the board and all pieces in the `GameManager` script.
- Use `[SerializeField]` for inspector variables
- Save progress regularly during development
- IMPORTANT: DO not use the Unity Editor to add the board and pieces to the scene.
- IMPORTANT: Add a `BoardClickPlane` GameObject at Y position = 0 and scale of X = 4.8 Y = 1 and Z = 4.8.
- IMPORTANT: Assign a MeshCollider with Mesh value of Plane to the `BoardClickPlane` GameObject.
- IMPORTANT: Add a MeshFilter with Mesh value of Plane to the `BoardClickPlane` GameObject.
- IMPORTANT: Assign the `BoardClickPlane` GameObject a tag called `BoardClickPlane` to detect clicks on the board.
- IMPORTANT: Verify the correct action map is active (usually "UI" for mouse clicks)
- IMPORTANT: Check if Input Actions asset is assigned correctly
- IMPORTANT: Use direct mouse input for reliable clicking - e.g. Vector2 mousePosition = Mouse.current.position.ReadValue();
## Debugging Tips
### 1. Check Unity Console Logs
- Look for `MissingMethodException: Method 'OnClick' not found` errors
- Check for Input System related errors
- Enable debug logging in MouseInputController to trace click detection
### 2. Verify Input System Configuration
- Ensure PlayerInput component is properly configured
- Check if Input Actions asset is assigned correctly
- Verify the correct action map is active (usually "UI" for mouse clicks)
### 3. Test Raycast Detection
Add debug logging to MouseInputController to verify:
- Mouse clicks are detected
- Raycasts hit pieces correctly
- Raycasts hit board/empty squares
## Implementation Order
1. Set up the camera
2. Create base piece class and individual piece scripts
3. Set up GameManager with board initialization and BoardClickPlane
4. Create mouse input controller for piece selection and movement
5. Implement piece positioning and rotation system
6. Create AI opponent with difficulty settings
```
* Copy the prompt above and paste it into the Coplay chat window.
* Press `Enter` to send the prompt to Coplay.
* Wait for Coplay to process the request and generate your chess game.
You've earned it. Coplay's got it from here.
* After a few minutes, check the Coplay chat window to see the progress of
the chess game creation.
* Coplay will provide updates on the game setup but will stop
every 20 actions to ask for your approval. This is expected and default behavior to ensure
you have control over the changes being made to your project.
* If Coplay asks for approval just click the **Approve** button to continue.
* If you want to make changes to the game, you can stop Coplay
by pressing `Shift + ⌫` or clicking the `Stop Thinking` button in the Coplay chat window.
* Once Coplay has finished creating the chess game,
you can play it by clicking the **Play** button in the Unity Editor.
* Follow the on-screen instructions to start playing against the AI opponent.
* If you want to change the AI difficulty, you can do
so by modifying the AI script in the `Assets/Chess Pieces/Scripts` folder.
We would love to see what you have created!
Share your chess game with us on social media and tag us!
Even better, share it in the Coplay Discord community.
Now that you have a basic chess game, consider enhancing it with additional features:
* [Implement a timer for each player's turn to increase the challenge.]() - Coming soon!
* [Create custom pieces in Blender and import them into Unity.]() - Coming soon!
* [Implement advanced AI strategies for a more challenging opponent.]() - Coming soon!
# Comparing Coplay with Unity MCP
Source: https://docs.coplay.dev/unity-mcp/coplay-comparison
Although both AI assistants are meant to make Unity easier and faster for game developers, there are quite a few differences that this post covers.
[See this blog post for a detailed comparison of Coplay and Unity MCP.](https://www.coplay.dev/blog/comparing-coplay-and-unity-mcp)