From 5aff60225d7160fac60ad427ea4dcce5b6efeffb Mon Sep 17 00:00:00 2001 From: David Gilbert <gilbert@vr.rwth-aachen.de> Date: Tue, 6 Feb 2024 16:33:11 +0100 Subject: [PATCH] fix(cave): Tries AddComponentByClass in the hopes of preventing further nullptr exceptions --- Source/RWTHVRToolkit/Private/Pawn/RWTHVRPawn.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Source/RWTHVRToolkit/Private/Pawn/RWTHVRPawn.cpp b/Source/RWTHVRToolkit/Private/Pawn/RWTHVRPawn.cpp index 62080986..ea27c0eb 100644 --- a/Source/RWTHVRToolkit/Private/Pawn/RWTHVRPawn.cpp +++ b/Source/RWTHVRToolkit/Private/Pawn/RWTHVRPawn.cpp @@ -50,11 +50,10 @@ void ARWTHVRPawn::BeginPlay() // This is required because for collision based movement, it can happen that the physics engine // for some reason acts different on the nodes, therefore leading to a potential desync when // e.g. colliding with an object while moving. - SyncComponent = NewObject<UDisplayClusterSceneComponentSyncParent>(this); - // SyncComponent->SetupAttachment(RootComponent); - SyncComponent->RegisterComponent(); - SyncComponent->AttachToComponent(RootComponent, FAttachmentTransformRules::SnapToTargetNotIncludingScale); + SyncComponent = Cast<USceneComponent>(AddComponentByClass(UDisplayClusterSceneComponentSyncParent::StaticClass(), + false, FTransform::Identity, false)); + AddInstanceComponent(SyncComponent); #endif } -- GitLab