Skip to content
Open
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
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

### Features

- Added PlayStation Native Support. The SDK now automatically syncs the scope - tags, breadcrumbs, context - to the native layer, so native crashes have the same rich context as managed events. ([#2433](https://github.com/getsentry/sentry-unity/pull/2433))
- On Windows, and with screenshot capture enabled, the SDK will now also capture and attach a screenshot to native crashes ([#2434](https://github.com/getsentry/sentry-unity/pull/2434))
- Added `SetBeforeSendScreenshot(Func<Texture2D, SentryEvent, Texture2D?>)` callback that provides the captured screenshot as a
`Texture2D` before JPEG compression. ([#2428](https://github.com/getsentry/sentry-unity/pull/2428))
Expand All @@ -21,7 +22,7 @@
- Access to the event context for conditional processing
- Added `SetBeforeSendViewHierarchy(Func<ViewHierarchy, SentryEvent, ViewHierarchy?>)` callback that provides the captured
`ViewHierarchy` to be modified before compression. ([#2429](https://github.com/getsentry/sentry-unity/pull/2429))

### Dependencies

- Bump Cocoa SDK from v8.57.2 to v8.57.3 ([#2424](https://github.com/getsentry/sentry-unity/pull/2424), [#2427](https://github.com/getsentry/sentry-unity/pull/2427))
Expand Down
16 changes: 16 additions & 0 deletions package-dev/Plugins/sentry_utils.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include <stdarg.h>
#include <stdio.h>

/**
* Wrapper around vsnprintf for Unity C# IL2CPP interop.
*
* This function provides a stable ABI entry point for Unity to call
* vsnprintf functionality across Windows, Linux, and PlayStation platforms.
*
* This wrapper is compiled as native C code where va_list is properly
* understood, then IL2CPP calls this wrapper with generic pointers.
*/
int vsnprintf_sentry(char *buffer, size_t size, const char *format, va_list args)
{
return vsnprintf(buffer, size, format, args);
}
114 changes: 114 additions & 0 deletions package-dev/Plugins/sentry_utils.c.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 22 additions & 16 deletions package-dev/Runtime/Sentry.Unity.Native.dll.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package-dev/Runtime/SentryInitialization.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#define SENTRY_NATIVE
#elif UNITY_GAMECORE
#define SENTRY_NATIVE
#elif UNITY_PS5
#define SENTRY_NATIVE
#elif UNITY_WEBGL
#define SENTRY_WEBGL
#endif
Expand Down Expand Up @@ -131,7 +133,7 @@ private Il2CppMethods _il2CppMethods
return null;
}

#if UNITY_ANDROID || UNITY_STANDALONE_LINUX
#if UNITY_ANDROID || UNITY_STANDALONE_LINUX || UNITY_PS5
// For ELF platforms, the 20-byte `NT_GNU_BUILD_ID` needs to be
// turned into a "little-endian GUID", which means the first three
// components need to be byte-swapped appropriately.
Expand Down
1 change: 1 addition & 0 deletions package-dev/Runtime/io.sentry.unity.dev.runtime.asmdef
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"LinuxStandalone64",
"Lumin",
"macOSStandalone",
"PS5",
"Stadia",
"Switch",
"WSA",
Expand Down
1 change: 1 addition & 0 deletions package/Runtime/io.sentry.unity.runtime.asmdef
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"LinuxStandalone64",
"Lumin",
"macOSStandalone",
"PS5",
"Stadia",
"Switch",
"WSA",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,12 @@ internal static void Display(ScriptableSentryUnityOptions options, SentryCliOpti
GUILayout.Label("Console", EditorStyles.boldLabel);

options.XboxNativeSupportEnabled = EditorGUILayout.Toggle(
new GUIContent("Xbox", "Whether to enable native crashes support on Xbox."),
new GUIContent("Xbox", "Whether to enable native crash support on Xbox."),
options.XboxNativeSupportEnabled);

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

EditorGUI.indentLevel--;
Expand Down
18 changes: 16 additions & 2 deletions src/Sentry.Unity.Editor/Native/BuildPostProcess.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using Sentry.Extensibility;
using Sentry.Unity.Editor.ConfigurationWindow;
using System.Text.RegularExpressions;
using Microsoft.Extensions.FileSystemGlobbing;
using UnityEngine;
using UnityEditor;
using UnityEditor.Build;
Expand All @@ -18,7 +17,9 @@ public static class BuildPostProcess
public static void OnPostProcessBuild(BuildTarget target, string executablePath)
{
var targetGroup = BuildPipeline.GetBuildTargetGroup(target);
if (targetGroup is not BuildTargetGroup.Standalone and not BuildTargetGroup.GameCoreXboxSeries)
if (targetGroup is not BuildTargetGroup.Standalone
and not BuildTargetGroup.GameCoreXboxSeries
and not BuildTargetGroup.PS5)
{
return;
}
Expand Down Expand Up @@ -47,10 +48,12 @@ public static void OnPostProcessBuild(BuildTarget target, string executablePath)
// The executable path resolves to the following when pointing Unity into a `build/platform/` directory:
// - Desktop: `./samples/unity-of-bugs/builds/windows/unityofbugs.exe`
// - Xbox: `./samples/unity-of-bugs/builds/xsx/`
// - PlayStation: `./samples/unity-of-bugs/builds/ps5/`
var buildOutputDir = targetGroup switch
{
BuildTargetGroup.Standalone => Path.GetDirectoryName(executablePath),
BuildTargetGroup.GameCoreXboxSeries => executablePath,
BuildTargetGroup.PS5 => executablePath,
_ => string.Empty
};

Expand Down Expand Up @@ -87,6 +90,7 @@ public static void OnPostProcessBuild(BuildTarget target, string executablePath)
BuildTarget.StandaloneOSX => options.MacosNativeSupportEnabled,
BuildTarget.StandaloneLinux64 => options.LinuxNativeSupportEnabled,
BuildTarget.GameCoreXboxSeries or BuildTarget.GameCoreXboxOne => options.XboxNativeSupportEnabled,
BuildTarget.PS5 => options.PlayStationNativeSupportEnabled,
_ => false,
};

Expand All @@ -108,6 +112,9 @@ private static void AddCrashHandler(IDiagnosticLogger logger, BuildTarget target
case BuildTarget.GameCoreXboxOne:
// No standalone crash handler for Xbox - comes with Breakpad
return;
case BuildTarget.PS5:
// No standalone crash handler for PlayStation
return;
default:
throw new ArgumentException($"Unsupported build target: {target}");
}
Expand Down Expand Up @@ -158,6 +165,13 @@ private static void UploadDebugSymbols(IDiagnosticLogger logger, BuildTarget tar
paths += $" \"{xboxSentryPluginPath}\"";
}
break;
case BuildTarget.PS5:
var playstationSentryPluginPath = Path.GetFullPath("Assets/Plugins/Sentry/");
if (Directory.Exists(playstationSentryPluginPath))
{
paths += $" \"{playstationSentryPluginPath}\"";
}
break;
case BuildTarget.StandaloneLinux64:
var linuxSentryDbg = Path.GetFullPath($"Packages/{SentryPackageInfo.GetName()}/Plugins/Linux/Sentry/libsentry.dbg.so");
if (File.Exists(linuxSentryDbg))
Expand Down
1 change: 0 additions & 1 deletion src/Sentry.Unity.Native/SentryNative.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ private static void ReinstallBackend()
switch (application.Platform)
{
case RuntimePlatform.Switch:
case RuntimePlatform.PS4:
case RuntimePlatform.PS5:
case RuntimePlatform.XboxOne:
case RuntimePlatform.GameCoreXboxSeries:
Expand Down
Loading
Loading