Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions package-dev/Runtime/SentryInitialization.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#define SENTRY_NATIVE
#elif UNITY_PS5
#define SENTRY_NATIVE
#elif UNITY_SWITCH
#define SENTRY_NATIVE
#elif UNITY_WEBGL
#define SENTRY_WEBGL
#endif
Expand Down
4 changes: 4 additions & 0 deletions src/Sentry.Unity.Editor/ConfigurationWindow/AdvancedTab.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,10 @@ internal static void Display(ScriptableSentryUnityOptions options, SentryCliOpti
options.PlayStationNativeSupportEnabled = EditorGUILayout.Toggle(
new GUIContent("PlayStation", "Whether to enable native crash support on PlayStation."),
options.PlayStationNativeSupportEnabled);

options.SwitchNativeSupportEnabled = EditorGUILayout.Toggle(
new GUIContent("Nintendo Switch", "Whether to enable native crash support on Nintendo Switch."),
options.SwitchNativeSupportEnabled);
}

EditorGUI.indentLevel--;
Expand Down
15 changes: 14 additions & 1 deletion src/Sentry.Unity.Editor/Native/BuildPostProcess.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ public static void OnPostProcessBuild(BuildTarget target, string executablePath)
var targetGroup = BuildPipeline.GetBuildTargetGroup(target);
if (targetGroup is not BuildTargetGroup.Standalone
and not BuildTargetGroup.GameCoreXboxSeries
and not BuildTargetGroup.PS5)
and not BuildTargetGroup.PS5
and not BuildTargetGroup.Switch)
{
return;
}
Expand Down Expand Up @@ -54,6 +55,7 @@ and not BuildTargetGroup.GameCoreXboxSeries
BuildTargetGroup.Standalone => Path.GetDirectoryName(executablePath),
BuildTargetGroup.GameCoreXboxSeries => executablePath,
BuildTargetGroup.PS5 => executablePath,
BuildTargetGroup.Switch => executablePath,
_ => string.Empty
};

Expand Down Expand Up @@ -91,6 +93,7 @@ and not BuildTargetGroup.GameCoreXboxSeries
BuildTarget.StandaloneLinux64 => options.LinuxNativeSupportEnabled,
BuildTarget.GameCoreXboxSeries or BuildTarget.GameCoreXboxOne => options.XboxNativeSupportEnabled,
BuildTarget.PS5 => options.PlayStationNativeSupportEnabled,
BuildTarget.Switch => options.SwitchNativeSupportEnabled,
_ => false,
};

Expand All @@ -115,6 +118,9 @@ private static void AddCrashHandler(IDiagnosticLogger logger, BuildTarget target
case BuildTarget.PS5:
// No standalone crash handler for PlayStation
return;
case BuildTarget.Switch:
// No standalone crash handler for Nintendo Switch
return;
default:
throw new ArgumentException($"Unsupported build target: {target}");
}
Expand Down Expand Up @@ -186,6 +192,13 @@ private static void UploadDebugSymbols(IDiagnosticLogger logger, BuildTarget tar
paths += $" \"{macOSSentryDsym}\"";
}
break;
case BuildTarget.Switch:
var switchSentryPluginPath = Path.GetFullPath("Assets/Plugins/Sentry/");
if (Directory.Exists(switchSentryPluginPath))
{
paths += $" \"{switchSentryPluginPath}\"";
}
break;
default:
logger.LogError($"Symbol upload for '{target}' is currently not supported.");
return;
Expand Down
5 changes: 3 additions & 2 deletions src/Sentry.Unity.Native/SentryNativeBridge.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ public static bool Init(SentryUnityOptions options)
{
_useLibC = Application.platform
is RuntimePlatform.LinuxPlayer or RuntimePlatform.LinuxServer
or RuntimePlatform.PS5;
or RuntimePlatform.PS5
or RuntimePlatform.Switch;
_isWindows = Application.platform is RuntimePlatform.WindowsPlayer or RuntimePlatform.WindowsServer;

var cOptions = sentry_options_new();
Expand Down Expand Up @@ -62,7 +63,7 @@ is RuntimePlatform.LinuxPlayer or RuntimePlatform.LinuxServer
if (_isWindows)
{
options.DiagnosticLogger?.LogDebug("Setting CacheDirectoryPath on Windows: {0}", dir);
sentry_options_set_database_pathw(cOptions, dir);
// sentry_options_set_database_pathw(cOptions, dir);
}
else
{
Expand Down
2 changes: 2 additions & 0 deletions src/Sentry.Unity/ScriptableSentryUnityOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ public static string GetConfigPath(string? notDefaultConfigName = null)
[field: SerializeField] public bool LinuxNativeSupportEnabled { get; set; } = true;
[field: SerializeField] public bool XboxNativeSupportEnabled { get; set; } = true;
[field: SerializeField] public bool PlayStationNativeSupportEnabled { get; set; } = true;
[field: SerializeField] public bool SwitchNativeSupportEnabled { get; set; } = true;
[field: SerializeField] public bool Il2CppLineNumberSupportEnabled { get; set; } = true;
[field: SerializeField] public SentryOptionsConfiguration? OptionsConfiguration { get; set; }

Expand Down Expand Up @@ -193,6 +194,7 @@ internal SentryUnityOptions ToSentryUnityOptions(
LinuxNativeSupportEnabled = LinuxNativeSupportEnabled,
XboxNativeSupportEnabled = XboxNativeSupportEnabled,
PlayStationNativeSupportEnabled = PlayStationNativeSupportEnabled,
SwitchNativeSupportEnabled = SwitchNativeSupportEnabled,
Il2CppLineNumberSupportEnabled = Il2CppLineNumberSupportEnabled,
PerformanceAutoInstrumentationEnabled = AutoAwakeTraces,
EnableLogs = EnableStructuredLogging,
Expand Down
8 changes: 7 additions & 1 deletion src/Sentry.Unity/SentryUnityOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,11 @@ public sealed class SentryUnityOptions : SentryOptions
/// </summary>
public bool PlayStationNativeSupportEnabled { get; set; } = true;

/// <summary>
/// Whether the SDK should add native support for Nintendo Switch
/// </summary>
public bool SwitchNativeSupportEnabled { get; set; } = true;

/// <summary>
/// Whether the SDK should add IL2CPP line number support
/// </summary>
Expand Down Expand Up @@ -502,7 +507,8 @@ or RuntimePlatform.LinuxServer
or RuntimePlatform.WebGLPlayer
or RuntimePlatform.GameCoreXboxSeries
or RuntimePlatform.GameCoreXboxOne
or RuntimePlatform.PS5;
or RuntimePlatform.PS5
or RuntimePlatform.Switch;
}

public override string ToString()
Expand Down
1 change: 1 addition & 0 deletions src/Sentry.Unity/SentryUnityOptionsExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ internal static bool IsNativeSupportEnabled(this SentryUnityOptions options, Run
RuntimePlatform.LinuxPlayer or RuntimePlatform.LinuxServer => options.LinuxNativeSupportEnabled,
RuntimePlatform.GameCoreXboxSeries or RuntimePlatform.GameCoreXboxOne => options.XboxNativeSupportEnabled,
RuntimePlatform.PS5 => options.PlayStationNativeSupportEnabled,
RuntimePlatform.Switch => options.SwitchNativeSupportEnabled,
_ => false
};
}
Expand Down
Loading