Repository navigation
Getting Started
Daisuke Tsukada edited this page Aug 26, 2025
·
1 revision
This guide will help you get Unity Remote Server up and running in your Unity project.
- Unity 2020.3 LTS or higher
- Windows, macOS, or Linux
- Basic knowledge of REST APIs
- Open your Unity project
- Open Package Manager: Window > Package Manager
- Click the + button in the top-left corner
- Select Add package from git URL...
- Enter:
https://github.com/dsgarage/UnityRemoteServer.git - Click Add
The package will be downloaded and imported automatically.
- Download the latest release from GitHub Releases
- Extract the archive
- Copy the
com.dsgarage.unity-remote-serverfolder to your project'sPackagesdirectory - Unity will automatically detect and import the package
Once installed, the server starts automatically when Unity Editor launches.
Open a terminal and run:
curl http://127.0.0.1:8787/healthYou should see a response like:
{
"ok": true,
"version": "1.0.0"
}You should see this message in the Unity Console:
[Remote] Listening on http://127.0.0.1:8787/
Let's make your first API call to refresh Unity assets:
curl -X POST http://127.0.0.1:8787/refresh \
-H "Content-Type: application/json" \
-d '{"force": false}'This will trigger Unity to refresh its asset database, similar to pressing Ctrl+R (Cmd+R on Mac).
# Get all errors
curl "http://127.0.0.1:8787/errors?level=error"
# Clear console
curl -X POST http://127.0.0.1:8787/errors/clear# Wait up to 60 seconds for compilation to finish
curl -X POST http://127.0.0.1:8787/awaitCompile \
-H "Content-Type: application/json" \
-d '{"timeoutSec": 60}'# Build for Android
curl -X POST http://127.0.0.1:8787/build \
-H "Content-Type: application/json" \
-d '{
"platform": "android",
"outputPath": "Builds/MyGame.apk"
}'Create a file unity-build.sh:
#!/bin/bash
# Configuration
SERVER="http://127.0.0.1:8787"
PLATFORM="android"
OUTPUT="Builds/game.apk"
echo "π Refreshing assets..."
curl -X POST "$SERVER/refresh" -H "Content-Type: application/json" -d '{"force": true}'
echo "β³ Waiting for compilation..."
curl -X POST "$SERVER/awaitCompile" -H "Content-Type: application/json" -d '{"timeoutSec": 120}'
echo "π Checking for errors..."
ERRORS=$(curl -s "$SERVER/errors?level=error")
if [ $(echo "$ERRORS" | jq '. | length') -gt 0 ]; then
echo "β Compilation errors found:"
echo "$ERRORS" | jq '.'
exit 1
fi
echo "ποΈ Building project..."
curl -X POST "$SERVER/build" \
-H "Content-Type: application/json" \
-d "{\"platform\": \"$PLATFORM\", \"outputPath\": \"$OUTPUT\"}"
echo "β
Build complete!"Create a file unity_control.py:
import requests
import time
import sys
class UnityController:
def __init__(self):
self.base_url = "http://127.0.0.1:8787"
def wait_for_server(self, timeout=30):
"""Wait for Unity server to be ready"""
start = time.time()
while time.time() - start < timeout:
try:
response = requests.get(f"{self.base_url}/health")
if response.status_code == 200:
print("β
Unity server is ready")
return True
except:
pass
time.sleep(1)
print("β Unity server timeout")
return False
def refresh_and_compile(self):
"""Refresh assets and wait for compilation"""
print("π Refreshing assets...")
requests.post(f"{self.base_url}/refresh", json={"force": True})
print("β³ Waiting for compilation...")
requests.post(f"{self.base_url}/awaitCompile", json={"timeoutSec": 120})
# Check for errors
errors = requests.get(f"{self.base_url}/errors?level=error").json()
if errors:
print("β Compilation errors:")
for error in errors:
print(f" - {error['message']}")
return False
print("β
Compilation successful")
return True
def build(self, platform, output_path):
"""Build the project"""
print(f"ποΈ Building {platform}...")
response = requests.post(
f"{self.base_url}/build",
json={
"platform": platform,
"outputPath": output_path
}
)
if response.status_code == 200:
print("β
Build complete!")
return True
else:
print(f"β Build failed: {response.text}")
return False
# Usage
if __name__ == "__main__":
controller = UnityController()
if not controller.wait_for_server():
sys.exit(1)
if not controller.refresh_and_compile():
sys.exit(1)
if not controller.build("android", "Builds/game.apk"):
sys.exit(1)- Read the API Documentation for detailed endpoint information
- Learn about Configuration options
- Create Custom Endpoints for your specific needs
- Set up CI/CD Integration
If the server doesn't start:
- Check Unity Console for error messages
- Ensure no other application is using port 8787
- Try restarting Unity Editor
- Check Troubleshooting guide for more solutions