The following tools are required before you can build and develop the SDK:
| Tool | Notes |
|---|---|
| Unity Hub | Required for managing Unity installations |
| Unity with iOS Build Support | The iOS module is required by Sentry.Unity.Editor.iOS. Install via Unity Hub. |
| .NET SDK | Version pinned in global.json |
| PowerShell | Install via dotnet tool install --global PowerShell |
| GitHub CLI | Recommended for downloading prebuilt native SDKs. On macOS: brew install gh |
| Unity CLI | Required for the Unity test harness; add unity to PATH |
Depending on which platforms you're targeting, you may also need:
- Android Build Support
- Desktop Platforms (Windows, macOS, Linux)
- WebGL
git clone https://github.com/getsentry/sentry-unity.git
cd sentry-unityRun the bootstrap script to initialize submodules, restore workloads, download prebuilt native SDKs and Sentry CLI, build the managed SDK, and configure optional sample settings.
pwsh bootstrap.ps1Bootstrap continues after recoverable failures and prints the command needed to retry each step. Set APPLE_ID to configure Apple signing and SENTRY_AUTH_TOKEN to configure CLI symbol upload before running it.
dotnet builddotnet build compiles the managed SDK only. It does not download dependencies or build native SDKs.
Note: Bootstrap initializes submodules. To recover from a failed submodule update, run
git submodule update --init --recursive.
If you need to build the native SDKs yourself instead of using prebuilt artifacts, follow the setup instructions below.
Required tools:
- CMake
- A supported C/C++ compiler
Required tools:
- Git (accessible from
PATH) - Android Studio
- JDK 17 (via sdkman or OpenJDK)
Android Studio Setup:
- Open Android Studio → Customize → All settings...
- Search for "SDK" → System Settings → Android SDK
- Install the Android SDK
- Switch to SDK Tools tab
- Check "Show Package Details"
- Under Android SDK Build-Tools, check "34"
- Apply
Environment Variables:
- Set
ANDROID_HOME:- macOS:
export ANDROID_HOME="$HOME/Library/Android/sdk" - Windows:
setx ANDROID_HOME "%localappdata%\Android\Sdk"
- macOS:
- Ensure
javais on your PATH (verify withjava --version)- Windows: Add the JDK
binfolder to PATH
- Windows: Add the JDK
The harness uses Pipeline when samples/unity-of-bugs-local is open, otherwise it runs
tests headlessly through Unity CLI. Add unity to PATH; to reuse an Editor, open the
sample in Unity 6.6+ with com.unity.pipeline and leave play mode stopped.
pwsh scripts/run-tests.ps1
pwsh scripts/run-tests.ps1 -Mode PlayMode -Filter "MyTest"
pwsh scripts/run-tests.ps1 -Mode EditModeRun dotnet build before tests after SDK changes. Filter narrows selected tests.
Build the Unity 6 sample for a specific platform through Unity CLI:
pwsh scripts/build-sample.ps1 -Target AndroidWhen the local sample is open in a Pipeline-enabled Unity Editor, the CLI uses that Editor. Otherwise it starts a batch-mode Editor without opening its UI.
Supported targets are StandaloneWindows64, StandaloneOSX, StandaloneLinux64,
Android, iOS, and WebGL. Build output is under
samples/unity-of-bugs-local/Builds/<Target>/.
Run integration tests locally using the same scripts as CI:
pwsh ./test/Scripts.Integration.Test/dev-integration-test.ps1 `
-UnityVersion "6000.5.0f1" `
-Platform "MacOS" `
-RepackThe wrapper locates Unity, builds and packages the SDK, then calls the core integration test script. See the script for additional parameters. Automated tests cover desktop, Android, iOS, WebGL, and Xbox; Switch and PS5 are build-only.
package-dev/- Development UPM packagepackage/- Release package template (used for publishing)samples/unity-of-bugs/- Unity 2021 compatibility sample projectsamples/unity-of-bugs-local/- Unity 6 development sample project with shared assetssrc/- Source codetest/- Tests and integration test scripts
- Open
Sentry.Unity.slnin your IDE (e.g., Rider, Visual Studio) - Build the solution — artifacts are placed in
package-dev/ - Open
samples/unity-of-bugs-localvia Unity Hub - Configure via Tools → Sentry and enter your DSN
- Click Play and test your changes
Do not edit generated assemblies or downloaded native artifacts in package-dev/.
The build uses the Unity version from samples/unity-of-bugs/ProjectSettings/ProjectVersion.txt. To use a different version:
export UNITY_VERSION=2022.3.44f1CI validates that package contents don't change accidentally. To accept intentional changes:
pwsh ./test/Scripts.Tests/test-pack-contents.ps1 acceptTo build, alias, package, and update the snapshot in one step:
pwsh ./scripts/repack.ps1Ensure the repository is clean before running
repack.ps1.
Releases are prepared manually through release.yml with Craft. CI builds the package-release artifact; Craft publishes it to the unity package repo, GitHub, and the registry. The package directory contains template files used during this process.
Do not copy
package-devspecific files (package.json,*.asmdef) intopackage.