diff --git a/CHANGELOG.md b/CHANGELOG.md index ad176e1b3..e61bfd6bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### Features +- The SDK now reports the game's name as part of the app context ([2083](https://github.com/getsentry/sentry-unity/pull/2083)) - The SDK now reports the active scene's name as part of the `Unity Context` ([2084](https://github.com/getsentry/sentry-unity/pull/2084)) ### Dependencies diff --git a/src/Sentry.Unity/Integrations/UnityScopeIntegration.cs b/src/Sentry.Unity/Integrations/UnityScopeIntegration.cs index 8566db6bd..23e7b9814 100644 --- a/src/Sentry.Unity/Integrations/UnityScopeIntegration.cs +++ b/src/Sentry.Unity/Integrations/UnityScopeIntegration.cs @@ -68,6 +68,7 @@ private static void PopulateSdk(SdkVersion sdk) private void PopulateApp(App app) { + app.Name = _application.ProductName; app.StartTime = MainThreadData.StartTime; var isDebugBuild = MainThreadData.IsDebugBuild; app.BuildType = isDebugBuild is null ? null : (isDebugBuild.Value ? "debug" : "release"); diff --git a/test/Sentry.Unity.Tests/UnityEventScopeTests.cs b/test/Sentry.Unity.Tests/UnityEventScopeTests.cs index 283bb6d97..5be314652 100644 --- a/test/Sentry.Unity.Tests/UnityEventScopeTests.cs +++ b/test/Sentry.Unity.Tests/UnityEventScopeTests.cs @@ -259,6 +259,7 @@ public void DeviceUniqueIdentifierWithSendDefaultPii_IsNotNull() public void AppProtocol_Assigned() { // arrange + _testApplication = new TestApplication(productName: "TestGame"); var sut = new UnityScopeUpdater(_sentryOptions, _testApplication); var scope = new Scope(_sentryOptions); @@ -266,10 +267,26 @@ public void AppProtocol_Assigned() sut.ConfigureScope(scope); // assert + Assert.IsNotNull(scope.Contexts.App.Name); Assert.IsNotNull(scope.Contexts.App.StartTime); Assert.IsNotNull(scope.Contexts.App.BuildType); } + [Test] + public void AppProtocol_AppNameIsApplicationName() + { + // arrange + _testApplication = new TestApplication(productName: "TestGame"); + var sut = new UnityScopeUpdater(_sentryOptions, _testApplication); + var scope = new Scope(_sentryOptions); + + // act + sut.ConfigureScope(scope); + + // assert + Assert.AreEqual(scope.Contexts.App.Name, _testApplication.ProductName); + } + [Test] public void UserId_SetIfEmpty() {