feat(switch2): add Nintendo Switch 2 support - #2834
Open
bitsandfoxes wants to merge 3 commits into
Open
Conversation
Recognise the platform and route it through the existing Switch implementation: UNITY_SWITCH2 defines SENTRY_NATIVE_SWITCH2, which selects SentryNativeSwitch as the platform configuration, and both assembly definitions now include Switch 2 so the runtime code ships to it. Switch 2 shares SwitchNativeSupportEnabled rather than introducing a second option, since it shares the implementation. Which platforms an assembly or a stub ships to is decided by its plugin metadata, so Switch 2 reuses the existing Switch native assembly and the existing stub rather than duplicating either. The build preprocessor now runs for both targets, resolves the required libraries per platform, and toggles stub compatibility for whichever target is being built - the importer tracks that per target, so the two do not interfere. RuntimePlatform.Switch2 and BuildTarget.Switch2 only exist in Unity 6000.3 and newer while the SDK still supports 2021.3, and these assemblies compile against a single Unity version, so both are matched by name rather than by enum member - referencing them directly would stop the SDK building against older editors. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ABHTqM37qGAc9iQZcdbdY8
bitsandfoxes
force-pushed
the
feat/switch2-support
branch
from
September 4, 2026 11:58
5f3f2cd to
dead379
Compare
Contributor
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit c48a310. Configure here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Brings up Nintendo Switch 2 by routing it through the existing Switch implementation rather than duplicating it.
What
UNITY_SWITCH2intoSENTRY_NATIVE_SWITCHas well.IsNativeSupportEnabledmaps the platform toSwitchNativeSupportEnabled, Switch 2 shares the option.SwitchNativePluginBuildPreProcessnow runs for both targets, resolves required libraries per platform (Assets/Plugins/Sentry/{Switch,Switch2}/), and toggles stub compatibility for whichever target is building.Why
Before the
IsNativeSupportEnabledmapping,SentryNativeSwitch.Configurewas reached but bailed out of immediately:The switch expression had no
Switch2case, so it fell through to the default and returnedfalse. Native support could never initialize regardless of how the project was configured. After the fix the full sequence runs — temporary storage mounts, the native SDK initializes, and scope sync starts syncing breadcrumbs, user and trace.No duplicated assembly or stub
Both are gated by plugin metadata, which is what decides where they ship. Both utilize the same stub in case of no native SDK being found.
Matching by name
RuntimePlatform.Switch2andBuildTarget.Switch2only exist in Unity 6000.3 and newer. So instead of relying on the enum being preset we do a comparison by name forSwitch2instead.Verified on a Switch 2 devkit
Native initialization completes and scope sync is live.