Quick Start
Develop and test your game's API calls in Unity without waiting for backend services.
Video
The Problem
Backend's behind? Network unstable? Want to work offline? Need to test errors?
- Backend’s not ready → define the API contract yourself, build now, switch to real backend later
- Need to test errors → configure success/error/timeout/invalid responses on demand
- Want offline dev → run the game without network, no VPN needed
- Testing pagination → cycle through different responses automatically
Route API calls to:
- Real backends (production, staging)
- QA servers
- Localhost
- Mock responses (custom status codes, latency, data)

Installation
- Open Unity Asset Store
- Search "API Mocking Toolkit" →
Import - Import all files
Requirements: Unity 2021.3+, no external dependencies
Demo Scene
| 1. Open demo scene | Assets > CodeCarnage > ApiMockingToolkit > Samples > DemoScene > DemoScene.unity |
| 2. Press Play | Scene loads with two buttons: Get Users and Get Posts |
| 3. Click "Get Users" | Sends request → Toolkit intercepts → Returns mock data instantly, no internet needed |
| 4. Click "Get Posts" multiple times | Cycles through pages 1 → 2 → 3 → 1 (Response Strategies in action) |
How It Works
Open DemoController.cs:
public async void OnGetUsersClicked()
{
var response = await ApiClient.Get("{{baseUrl}}/users");
DisplayResponse(response);
}
Standard API call. {{baseUrl}} resolves per active environment. Toolkit intercepts matching URLs and returns your mock data. No if (testing) checks. Same code works with mocks or real backends.
Create Your First Endpoint
Mock your game's API using JSONPlaceholder's /comments endpoint as a stand-in. Works offline with mocks, or online hitting the real API.
| 1. Open toolkit window | Window > CodeCarnage > API Mocking Toolkit |
| 2. Create endpoint | Click "+ Endpoint", set:
|
| 3. Add mock response | Status Code: |
| 4. Enable Offline Mode | Toggle ON at the top |
| 5. Test | |
Next Steps
- Core Features – Response strategies, environments, sessions, OpenAPI, error simulation
- Guides – Real-world workflows
- API Reference – Full API surface
Troubleshooting
Nothing happening? Make sure Offline Mode is ON, URL matches exactly (case-sensitive), check Console for errors.
Demo scene not working? Check "Demo Scene Collection" is selected, re-import Samples from Package Manager.
Questions? Check Troubleshooting FAQ or email support@codecarnage.com