Unity Session Replay installation
- 1
Install the SDK
RequiredRequires Unity 2021.3 LTS or later with .NET Standard 2.1 API compatibility level.
In the Unity Editor, open Window > Package Manager, click the + button, select Add package from git URL, and enter:
textSee the Unity SDK docs for other installation methods and full setup instructions.
- 2
Enable session recordings in project settings
RequiredGo to your PostHog Project Settings and enable Record user sessions. Session recordings will not work without this setting enabled.
- 3
Configure PostHog with session replay
RequiredAdd
SessionReplay = trueto your PostHog configuration. You can also configure it via the Unity Inspector in Edit > Project Settings > PostHog.GameManager.csHow it worksThe Unity SDK captures screenshots using
AsyncGPUReadbackto avoid blocking the main thread. It also records touch/mouse input, network requests, and console logs alongside each screenshot. Session replay requiresAsyncGPUReadbacksupport and is automatically disabled on WebGL.No masking supportThe Unity SDK uses screenshot-based capture. Unlike web and mobile SDKs, there is no built-in masking for text, images, or other UI elements. Screenshots may contain sensitive information. Make sure you are not displaying personal data or secrets on screen during recorded sessions.
LimitationsThe Unity SDK reads the Record user sessions toggle from PostHog project settings, but more granular options like
CaptureNetworkTelemetry,CaptureLogs, and sampling are not remotely configurable and must be set locally in code at initialization time. - 4
Watch session recordings
RecommendedVisit your site or app and interact with it for at least 10 seconds to generate a recording. Navigate between pages, click buttons, and fill out forms to capture meaningful interactions.
- 5
Next steps
RecommendedNow that you're recording sessions, continue with the resources below to learn what else Session Replay enables within the PostHog platform.
Resource Description Watching recordings How to find and watch session recordings Privacy controls How to mask sensitive data in recordings Network recording How to capture network requests in recordings Console log recording How to capture console logs in recordings More tutorials Other real-world examples and use cases