Démarrage rapide
Develop and test your game's API calls in Unity without waiting for backend services.
🎥 Watch First
Prefer video? Watch this quick tutorial:
Or follow the written guide below ↓
The Problem You're Solving
You're building a Unity game that talks to a backend server. At minimum, you need:
| What your game needs | What's getting in the way |
|---|---|
|
|
API Mocking Toolkit solves this. Run your entire game without a backend. Test any scenario. Work completely offline.
What You'll Learn
In this quick guide, you'll:
- ✅ Install API Mocking Toolkit
- ✅ Run the demo scene (see it working instantly!)
- ✅ Create your first mock API endpoint
Real Developer Scenarios
See yourself in these situations?
| Scenario | Without API Mocking Toolkit | With API Mocking Toolkit |
|---|---|---|
| Backend team is behind |
|
|
| Testing edge cases |
|
|
| Working offline |
|
|
Sound familiar? Let's fix it.
Diagram concept (to be rendered as a static image later): your game talks to the API Mocking Toolkit, which can in turn route calls to:
- The real backend server
- A local development server
- A mocked success response
- A mocked error response
↑ One tool, four ways to test – real backend, local server, mock success, mock error
Make your game work without a backend.
No live backend required during development. Your game talks to mocked APIs running entirely inside Unity.
Installation (Unity Asset Store)
- Open the Unity Asset Store
- Search for "API Mocking Toolkit" or open the Asset Store page directly in your browser.
- Click
Import - Import all files
Requirements:
- Unity 2021.3 or later
- No external dependencies
Run the Demo Scene
Follow these steps to run the included demo scene and verify that the toolkit is installed correctly:
| Step 1 – Open the demo scene | In Unity, open What you'll see:
|
| Step 2 – Press Play | Hit the Play button. The scene runs. |
| Step 3 – Click "Get Users" | What happens:
Example request/response: |
| Step 4 – Click "Get Posts" multiple times | Watch this:
This is Response Strategies – API Mocking Toolkit cycles through different responses automatically, which is useful for testing pagination and repeated calls. |
What just happened?
You just ran a fully functional game that makes API calls through ApiClient, receives responses, and handles data without depending on a live backend.
- ✅ No backend team required during this stage of development
- ✅ No network connection required while using only mocked APIs
- ✅ Fast, predictable responses
- ✅ Complete control over the data you test with
How It Works
You might be wondering: "How does this work?"
Let's peek under the hood. Open DemoController.cs:
public async void OnGetUsersClicked()
{
// This is normal Unity HTTP code - nothing special!
var response = await ApiClient.GetAsync(
"https://jsonplaceholder.typicode.com/users"
);
// Display the response in the UI
DisplayResponse(response);
}
That's it. Standard API call. No magic.
Behind the scenes:
-
You configured an endpoint (already done in the demo scene)
- URL:
https://jsonplaceholder.typicode.com/users - Mock response:
[{user data...}]
- URL:
-
API Mocking Toolkit intercepts
- Sees the URL matches your config
- Returns your mock data instead of hitting the real server
-
Your code gets the response
- Doesn't know it's mocked
- Works exactly like a real API
The key idea: your game code doesn't change.
Same code works with:
- ✅ Mocked data (when API Mocking Toolkit is active)
- ✅ Real backend (when you turn mocking off)
No if (testing) checks. No special test code. Just works.
Create Your First Endpoint (Your Turn!)
Now for the real power: Mock YOUR game's API.
Imagine you're building an RPG. You need a player profile API, but the backend isn't ready yet.
Let's build it anyway:
| Step 1 – Open the API Mocking Toolkit window | In Unity, open |
| Step 2 – Create an endpoint | Click "+ Endpoint". In the form, set:
|
| Step 3 – Add a mock response | In the Response section, set Status Code to |
| Step 4 – Enable Offline Mode | Toggle Offline Mode ON at the top of the window so the game uses mocked responses instead of the real backend. |
| Step 5 – Test it | Create a test script: |
Run it! You'll see your mock data in the console.
What's Next?
🎉 Congratulations! You've:
- Installed API Mocking Toolkit
- Run the demo scene
- Created your first endpoint
Continue learning:
- Core Features (Deep Dive) – Response strategies, offline mode, environments, sessions, OpenAPI, error simulation, and more
- Guides – Workflows and real-world scenarios
- API Reference – Full API surface and code examples
Watch the video again later:
- Use it as a visual cheatsheet when you come back to the tool
Troubleshooting
Nothing happening?
- Make sure Offline Mode is ON
- Check the URL matches exactly (case-sensitive)
- Look for errors in the Console
Demo scene not working?
- Make sure "Demo Scene Collection" is selected in dropdown
- Re-import the Samples folder from Package Manager
Need help?