Capture screenshots in Unity
Add screenshot and scrolling GIF capabilities to your Unity projects with UnityWebRequest. Perfect for in-game browsers, documentation, and UI textures.
Installation
- 1UnityWebRequest is included in Unity Engine
- 2Get your API key from the dashboard
- 3Set the X-KEY header in your requests
Authentication
Include your API key in the X-KEY header with every request:
using UnityEngine.Networking;
UnityWebRequest request = UnityWebRequest.Get(url);
request.SetRequestHeader("X-KEY", "your-api-key");
yield return request.SendWebRequest();
byte[] bytes = request.downloadHandler.data;Unity Screenshot Example
Capture a screenshot or create a scrolling GIF animation with a simple GET request:
IEnumerator CaptureScreenshot() {
using var request = UnityWebRequest.Get(
"https://api.scrnpix.com/screenshot?url=https%3A%2F%2Fexample.com&width=1280&height=720&format=png"
);
request.SetRequestHeader("X-KEY", "your-api-key");
yield return request.SendWebRequest();
var texture = new Texture2D(2, 2);
texture.LoadImage(request.downloadHandler.data);
}IEnumerator CaptureAnimation() {
using var request = UnityWebRequest.Get(
"https://api.scrnpix.com/animate?url=https%3A%2F%2Fexample.com&scroll_duration=3000&scroll_easing=ease-in-out"
);
request.SetRequestHeader("X-KEY", "your-api-key");
yield return request.SendWebRequest();
// Save or process request.downloadHandler.data
}Response Format
On success, the API returns the image binary data directly in the response body.
| Status Code | 200 OK |
| Content-Type | image/png, image/jpeg, or image/gif |
| Body | Binary image data (byte[]) |
| Error Response | Error message with 4xx/5xx status |
Key Features
Zero Setup
UnityWebRequest is built into Unity. No browser plugins or native extensions required.
Production Ready
Built on Cloudflare Workers with global edge network. Handles concurrency and browser lifecycle automatically.
Unity Integration
Load into Texture2D for UI. Works in Editor, Standalone, WebGL, and mobile builds.
Rich Features
Custom viewport sizes, full page capture, PNG/JPEG formats, scrolling GIFs with 15 easing functions.
Frequently Asked Questions
Do I need any Unity plugins?
No. UnityWebRequest is built into Unity. Use Texture2D.LoadImage() to convert bytes to textures.
Does this work in WebGL builds?
Yes. Scrnpix works with all Unity platforms — Editor, Standalone, WebGL, iOS, Android, and consoles.
How do I display the screenshot in Unity?
Create a Texture2D, call LoadImage(bytes), then apply to a RawImage or material for display.
What Unity version is required?
Unity 2018.4+ with UnityWebRequest. The API is a simple HTTP GET request.
Ready to capture screenshots in Unity?
Get your API key and start rendering screenshots in seconds. Free tier includes 50 screenshots per month.
Start Free