I am trying to replicate the VR Pawn with a C++ class. I’ve nativized a 4.26 BP to study its code, but I can’t seem to get my 5.0 version working.
My pawn class has a “TObjectPtr TeleportTrace”, and in the constructor, I do this:
static ConstructorHelpers::FObjectFinder<UNiagaraSystem> Trace(TEXT("/Game/VRTemplate/VFX/NS_TeleportTrace.NS_TeleportTrace"));
TeleportTrace = CreateDefaultSubobject<UNiagaraComponent>(TEXT("TeleportTrace"));
TeleportTrace->SetupAttachment(MotionControllerRight);
TeleportTrace->SetAsset(Trace.Object);
TeleportTrace->SetRelativeLocation(FVector(0.0));
TeleportTrace->SetTickBehavior(ENiagaraTickBehavior::UsePrereqs);
TeleportTrace->SetAllowScalability(true);
TeleportTrace->SetAutoActivate(true);
TeleportTrace->SetVisibility(false, false);
TArray<FVector> TracePoints;
TracePoints.Add(FVector(0.0, 0.0, 0.0));
TracePoints.Add(FVector(20.0, 0.0, 10.0));
TracePoints.Add(FVector(40.0, 0.0, 0.0));
TracePoints.Add(FVector(60.0, 0.0, -20.0));
TracePoints.Add(FVector(80.0, 0.0, -50.0));
UNiagaraDataInterfaceArrayFunctionLibrary::SetNiagaraArrayVector(TeleportTrace, FName(TEXT("User.PointArray")), TracePoints);
And then when I want to see it I just do “TeleportTrace->SetVisibility(true, false);”. But I never see it! What am I doing wrong?