I have a scene component attached to a character capsule.
UPROPERTY(VisibleDefaultsOnly, Category = VR)
USceneComponent* VROrigin;
It is initialized in the constructor like so:
VROrigin = ObjectInitializer.CreateDefaultSubobject<USceneComponent>(this, TEXT("VR Origin"));
VROrigin->SetupAttachment(GetCapsuleComponent());
VROrigin->SetRelativeLocation(FVector(0, 0, (GetCapsuleComponent()->GetScaledCapsuleHalfHeight() - FloorOffset_cm) * -1));
This works fine. However, When I do the SetRelativeLocation line inside the tick function, Unreal Engine has a fatal crash immediately upon starting the game.
What is going on?
EDIT: The same thing occurs when I try to set the relative location through blueprint.