Skip to content
Snippets Groups Projects
Commit 27e6d4f1 authored by David Gilbert's avatar David Gilbert :bug:
Browse files

fix(cave): Fixes crash when playing normally in desktop

parent 992d2776
No related branches found
No related tags found
2 merge requests!107UE5.4-2024.1-rc1,!98Improved join/attachment logic for clusters to support multi-cluster connections at some point
Pipeline #440347 failed
...@@ -78,7 +78,7 @@ void ARWTHVRPawn::NotifyControllerChanged() ...@@ -78,7 +78,7 @@ void ARWTHVRPawn::NotifyControllerChanged()
// Only cluster types are valid here as they are set on connection. // Only cluster types are valid here as they are set on connection.
// For all other player types this is a race condition // For all other player types this is a race condition
if (Type == EPlayerType::nDisplayPrimary || GetNetMode() == NM_Standalone) if (Type == EPlayerType::nDisplayPrimary || Type == EPlayerType::nDisplaySecondary)
{ {
UE_LOGFMT(Toolkit, Display, "ARWTHVRPawn: Attaching Cluster to Pawn {Pawn}.", GetName()); UE_LOGFMT(Toolkit, Display, "ARWTHVRPawn: Attaching Cluster to Pawn {Pawn}.", GetName());
AttachClustertoPawn(); AttachClustertoPawn();
...@@ -266,14 +266,17 @@ void ARWTHVRPawn::AttachClustertoPawn() ...@@ -266,14 +266,17 @@ void ARWTHVRPawn::AttachClustertoPawn()
if (const ARWTHVRPlayerState* State = GetPlayerState<ARWTHVRPlayerState>()) if (const ARWTHVRPlayerState* State = GetPlayerState<ARWTHVRPlayerState>())
{ {
if (!State->GetCorrespondingClusterActor()) const auto ClusterActor = State->GetCorrespondingClusterActor();
if (!ClusterActor)
{
UE_LOGFMT( UE_LOGFMT(
Toolkit, Error, Toolkit, Error,
"ARWTHVRPawn::AttachClustertoPawn: GetCorrespondingClusterActor returned null! This won't work on " "ARWTHVRPawn::AttachClustertoPawn: GetCorrespondingClusterActor returned null! This won't work on "
"the Cave."); "the Cave.");
return;
}
const FAttachmentTransformRules AttachmentRules = FAttachmentTransformRules::SnapToTargetNotIncludingScale; const FAttachmentTransformRules AttachmentRules = FAttachmentTransformRules::SnapToTargetNotIncludingScale;
bool bAttached = State->GetCorrespondingClusterActor()->AttachToComponent(GetRootComponent(), AttachmentRules); bool bAttached = ClusterActor->AttachToComponent(GetRootComponent(), AttachmentRules);
// State->GetCorrespondingClusterActor()->OnAttached(); // State->GetCorrespondingClusterActor()->OnAttached();
UE_LOGFMT(Toolkit, Display, UE_LOGFMT(Toolkit, Display,
"ARWTHVRPawn: Attaching corresponding cluster actor to our pawn returned: {Attached}", bAttached); "ARWTHVRPawn: Attaching corresponding cluster actor to our pawn returned: {Attached}", bAttached);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment