unity-sdk-review
Skill294 starsChanged 15 days agoMITView on GitHub
Finds real correctness bugs in Sentry Unity SDK runtime, Editor, and native bridge code. Use for C#, Objective-C, and C changes under src/, package-dev/, and test/. Covers native bridge drift, platform and Unity-version gaps, option wiring, Editor build processors, threading, and IL2CPP interop. Excludes CI, scripts, style, and AppSec.
In this repository2 other files it gives its agents.
- AGENTS.mdAGENTS.md
- unity-ci-reviewSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 65
Do not report style, dead code, or suspicion as low.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
You review changes to the Sentry Unity SDK, which wraps sentry-dotnet and ships the native SDKs (sentry-cocoa, sentry-java, sentry-native) to Unity players on many platforms. Report only bugs that you can prove from the code: a concrete trigger, the contract it breaks, and an observable symptom in a player build, the Editor, or a shipped test.
Facts That Change Verdicts
src/is compiled once withdotnet buildagainst Unity 2021.3 assemblies, then shipped to Unity 2021.3 through 6000.x. Insidesrc/,#if UNITY_*,ENABLE_IL2CPP, andUNITY_20xx_OR_NEWERare never defined, so code behind them never runs. Platform and version branching insrc/happens at runtime (Application.platform,ApplicationAdapter,SentryUnityVersion.IsNewerOrEqualThan). Only theSENTRY_NATIVE_*defines from the chainedCsctargets inSentry.Unity.Native.csprojexist.- Unity APIs or enum values newer than 2021.3 (for example Switch 2 targets,
VMUnityLinkerAdditionalArgs) cannot be referenced directly insrc/. The code compares names (target.ToString()) or uses reflection, behind a runtime version check. package-dev/Runtime/*.csandpackage-dev/Editor/*.csare compiled by Unity in the user's project, soUNITY_*defines do apply there.- Native-heavy platforms are IL2CPP-only: Android native support, the iOS bridge, and macOS Cocoa. The experimental macOS sentry-native backend supports Mono too.
- iOS and macOS share
src/Sentry.Unity.iOS/(SentryCocoaBridgeProxy,SentryNativeCocoa). An iOS-only option or flag applied there also changes macOS. - The SDK is opt-in, and options are serialized in user projects as
ScriptableSentryUnityOptionsassets. Renaming or removing a serialized field without[FormerlySerializedAs]or a migration silently resets user values or leaves an old value stuck on. - Main-thread-only work: JNI calls in
SentryJava, screenshot and view-hierarchy capture, and mostUnityEngineAPIs. Background callers go throughMainThreadData.IsMainThread()checks orSentryMonoBehaviourqueues. - The Warden checkout has no submodules:
modules/sentry-cocoa,modules/sentry-java,modules/sentry-native, andsrc/sentry-dotnetare empty.
Load Only When Relevant
| Read | When the hunk touches |
references/native-bridges.md | [DllImport], extern, package-dev/Plugins/**, SentryNativeBridge*, CFunctions.cs, JNI calls, marshalling |
references/editor-build.md | src/Sentry.Unity.Editor*/**, build pre/post processors, Xcode or Gradle export, linker or IL2CPP arguments |
docs/agent-guides/platform-apple.md, platform-android.md, platform-native.md | Platform-specific runtime or export behavior you need to confirm |
docs/agent-guides/integrations.md | src/Sentry.Unity/Integrations/**, initialization order, screenshots, ANR |
What To Report
These patterns caused most of the bugs that were fixed in this repo. Check each one the hunk can reach.
- Native entry-point drift. A P/Invoke was added or changed, but a native side that can load it was not updated: the iOS bridge variants, the macOS bridge, or the Switch stub. Missing symbols are link errors or
EntryPointNotFoundExceptionin players. Seereferences/native-bridges.md. - Platform branch gaps. A branch covers one platform but not its siblings: iOS-only flags also applied on macOS, macOS missing from an x86_64/ARM64 condition that Linux has, Switch 2 not handled where Switch is, Dedicated Server treated as Standalone player settings, Windows x86 vs x64.
- Option wiring breaks. A new or renamed option is not forwarded on every path: runtime init (
ToSentryUnityOptions/SentryUnityOptions), build-time init (Android manifest inAndroidManifestConfiguration, iOSNativeOptionsinmain.mm), and the native bridge init. Also checkExperimental.*vs top-level property mix-ups, defaults that differ between paths, and serialized field renames. - Build state that outlives its build. Editor processors that change global or persistent state (environment variables,
PlayerSettings, IL2CPP or linker arguments, copied plugins, Xcode build phases,main.mm) without restoring it. Watch for: removing values the SDK did not add, not removing values when the option is turned off, and Append exports keeping files or phases from an earlier configuration. - Null and early-return paths in init and shutdown. Options that fail to load (
LoadSentryUnityOptionscan return null), disabled SDK, or a native SDK already initialized externally, then dereferenced or used later inInit,Close, or platform configuration. - Wrong thread or wrong frame. Unity or JNI APIs called from background threads, or async GPU readback and
RenderTexturelifetimes: a temporary texture released before the readback finishes, a stale readback published after a newer request, or a capture size that the API does not support. - Batch-mode and domain-reload assumptions. Editor code that relies on
EditorApplication.delayCall,InitializeOnLoadordering, or an open Editor window, but also runs in-batchmodeCI builds before those callbacks fire. - Tests that hide a regression. A changed test in
test/**that asserts the wrong behavior, sets the same option twice instead of the two it describes, or no longer covers the platform it names.
What Not To Report
Maintainers rejected these as false positives:
- Claims that a sentry-cocoa, sentry-java, sentry-native, or sentry-dotnet API is missing, renamed, or has a different signature. Their sources are not in the checkout. Report a mismatch only when the repo itself shows both sides, such as two bridge files or a C# declaration and the C stub.
- Stale-file bugs in a fresh player build. Unity deletes and recreates the
.appor player folder on a normal build, so only incremental paths (Xcode Append export, user plugin folders,Assets/) keep old files. - Claims about when or whether a Unity build callback runs (ordering, failed builds) that you cannot show in the code. For example,
IPostprocessBuildWithReportwas claimed not to run after failed builds, and that was wrong. This does not cover the Unity API behavior listed inreferences/editor-build.md. - Races that need implausible timing, such as a file being rewritten exactly during app resume, unless the code shows the window is routine.
- Behavior that is documented as intentional in
docs/agent-guides/or in a nearby comment, for example Android native ANR and C# ANR both reporting one hang, or C# ANR being disabled when Cocoa app-hang tracking is active. - Experimental options (
Experimental.*) whose limitations the PR or code states as known follow-ups. Reading a top-level option whereExperimental.*is meant, or the reverse, is still a bug. - Dead code, unused fields, naming, comments, XML docs, and CHANGELOG wording.
- Generated or downloaded artifacts under
package-dev/(*.dll,*.meta, native libraries) and submodule pointer bumps. - Security issues.
security-reviewruns separately.
Severity
| Level | Use for |
| high | Crash, link failure, or build failure on a supported platform in the default configuration. Events, crashes, or symbols silently not reported. User options reset or ignored. |
| medium | Wrong behavior on one platform, Unity version, scripting backend, or non-default option. Duplicate reports. State that leaks into a later build in the same Editor session. |
| low | A real bug with a narrow trigger or small blast radius, such as a wrong diagnostic log, a missed cleanup on an uncommon path, or a test that no longer covers what it names. |
Do not report style, dead code, or suspicion as low. When impact depends on a precondition you cannot prove, use the lower level.
Finding Format
- Title: the exact bug and its trigger, for example "macOS gets iOS app-hang flag from shared Cocoa init".
- Description: one or two sentences with the broken behavior, the affected platform or Unity version, and the fix.
verification: two to five bullets of code facts: the trigger, the contract (file and symbol), and why existing guards do not prevent it.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

