Skip to content

Commit 5d5ba2d

Browse files
authored
Fix missing explicit initializers for UObject-derived classes in Unreal Engine code examples (#15945)
This PR adds missing explicit `Initialize()` method calls for some Sentry entities derived from Unreal’s default UObject class in C++ code examples. These calls became required during object instantiation starting with plugin version `1.0.0` (see [migration guide](https://docs.sentry.io/platforms/unreal/migration/#sentry-classes-instantiation)) Related to getsentry/sentry-unreal#1185.
1 parent 00b1508 commit 5d5ba2d

5 files changed

Lines changed: 7 additions & 0 deletions

File tree

docs/platforms/unreal/enriching-events/identify-user/index.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ TMap<FString, FString> AdditionalData;
4646
AdditionalData.Add("DogName", "Spot");
4747

4848
USentryUser* User = NewObject<USentryUser>();
49+
User->Initialize();
4950
User->SetEmail("user@sentry.io");
5051
User->SetId("123");
5152
User->SetUsername("AwesomeUser99");

docs/platforms/unreal/enriching-events/scopes/index.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ All data can be configured on the global scope using dedicated methods of `Sentr
4545
USentrySubsystem* SentrySubsystem = GEngine->GetEngineSubsystem<USentrySubsystem>();
4646

4747
USentryUser* SentryUser = NewObject<USentryUser>();
48+
SentryUser->Initialize();
4849
SentryUser->SetEmail("john.doe@example.com");
4950
SentryUser->SetId(42);
5051

platform-includes/capture-message/unreal.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ In a simplest case, it looks like this:
4848
USentrySubsystem* SentrySubsystem = GEngine->GetEngineSubsystem<USentrySubsystem>();
4949

5050
USentryEvent* Event = NewObject<USentryEvent>();
51+
Event->Initialize();
5152
Event->SetMessage("Message");
5253
Event->SetLevel(ESentryLevel::Info);
5354

@@ -60,6 +61,7 @@ You can also configure scope for some specific events:
6061
USentrySubsystem* SentrySubsystem = GEngine->GetEngineSubsystem<USentrySubsystem>();
6162
6263
USentryEvent* Event = NewObject<USentryEvent>();
64+
Event->Initialize();
6365
Event->SetMessage("Message");
6466
Event->SetLevel(ESentryLevel::Info);
6567

platform-includes/enriching-events/scopes/configure-scope/unreal.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ ScopeDelegate.BindDynamic(this, &USomeClass::HandleScopeDelegate);
55
void USomeClass::HandleScopeDelegate(USentryScope* Scope)
66
{
77
USentryUser* SentryUser = NewObject<USentryUser>();
8+
SentryUser->Initialize();
89
SentryUser->SetEmail("john.doe@example.com");
910
SentryUser->SetId(42);
1011

@@ -25,6 +26,7 @@ Alternatively, all data can be configured on the global scope using dedicated me
2526
USentrySubsystem* SentrySubsystem = GEngine->GetEngineSubsystem<USentrySubsystem>();
2627
2728
USentryUser* SentryUser = NewObject<USentryUser>();
29+
SentryUser->Initialize();
2830
SentryUser->SetEmail("john.doe@example.com");
2931
SentryUser->SetId(42);
3032

platform-includes/enriching-events/set-user/unreal.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ TMap<FString, FString> AdditionalData;
55
AdditionalData.Add("DogName", "Spot");
66

77
USentryUser* User = NewObject<USentryUser>();
8+
User->Initialize();
89
User->SetEmail("user@sentry.io");
910
User->SetId("123");
1011
User->SetUsername("AwesomeUser99");

0 commit comments

Comments
 (0)