Hi!
I’m developing with Unreal 5.3.2.
I have a Pawn class with this constructor:
ASNVRPawn::ASNVRPawn()
{
// Set this pawn to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
VROrigin = CreateDefaultSubobject<USceneComponent>(TEXT("VR Origin"));
SetRootComponent(VROrigin);
MotionControllerLeftGrip = CreateDefaultSubobject<UMotionControllerComponent>(TEXT("Motion Controller Left Grip"));
MotionControllerRightGrip = CreateDefaultSubobject<UMotionControllerComponent>(TEXT("Motion Controller Right Grip"));
XRDeviceVisualizationLeft = CreateDefaultSubobject<UXRDeviceVisualizationComponent>(TEXT("XRDevice Visualization Left"));
XRDeviceVisualizationRight = CreateDefaultSubobject<UXRDeviceVisualizationComponent>(TEXT("XRDevice Visualization Right"));
MotionControllerLeftAim = CreateDefaultSubobject<UMotionControllerComponent>(TEXT("Motion Controller Left Aim"));
MotionControllerRightAim = CreateDefaultSubobject<UMotionControllerComponent>(TEXT("Motion Controller Right Aim"));
HandLeft = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("Hand Left"));
HandRight = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("Hand Right"));
WidgetInteractionLeft = CreateDefaultSubobject<UWidgetInteractionComponent>(TEXT("Widget Interaction Left"));
WidgetInteractionRight = CreateDefaultSubobject<UWidgetInteractionComponent>(TEXT("Widget Interaction Right"));
Camera = CreateDefaultSubobject<UCameraComponent>(TEXT("Camera"));
HeadMountedDisplayMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Head Mounted Display Mesh"));
MotionControllerLeftGrip->SetupAttachment(XRDeviceVisualizationLeft);
MotionControllerLeftGrip->SetupAttachment(HandLeft);
VROrigin->SetupAttachment(MotionControllerLeftGrip);
MotionControllerRightGrip->SetupAttachment(XRDeviceVisualizationRight);
MotionControllerRightGrip->SetupAttachment(HandRight);
VROrigin->SetupAttachment(MotionControllerRightGrip);
Camera->SetupAttachment(HeadMountedDisplayMesh);
VROrigin->SetupAttachment(Camera);
MotionControllerLeftAim->SetupAttachment(WidgetInteractionLeft);
VROrigin->SetupAttachment(MotionControllerLeftAim);
MotionControllerRightAim->SetupAttachment(WidgetInteractionRight);
VROrigin->SetupAttachment(MotionControllerRightAim);
}
I have declared the properties in this way:
public:
UPROPERTY(BlueprintReadOnly)
TObjectPtr<USceneComponent> VROrigin;
UPROPERTY(BlueprintReadOnly)
TObjectPtr<UMotionControllerComponent> MotionControllerLeftGrip;
UPROPERTY(BlueprintReadOnly)
TObjectPtr<UMotionControllerComponent> MotionControllerRightGrip;
UPROPERTY(BlueprintReadOnly)
TObjectPtr<UMotionControllerComponent> MotionControllerLeftAim;
UPROPERTY(BlueprintReadOnly)
TObjectPtr<UMotionControllerComponent> MotionControllerRightAim;
UPROPERTY(BlueprintReadOnly)
TObjectPtr<UXRDeviceVisualizationComponent> XRDeviceVisualizationLeft;
UPROPERTY(BlueprintReadOnly)
TObjectPtr<UXRDeviceVisualizationComponent> XRDeviceVisualizationRight;
UPROPERTY(BlueprintReadOnly)
TObjectPtr<USkeletalMeshComponent> HandRight;
UPROPERTY(BlueprintReadOnly)
TObjectPtr<USkeletalMeshComponent> HandLeft;
UPROPERTY(BlueprintReadOnly)
TObjectPtr<UWidgetInteractionComponent> WidgetInteractionLeft;
UPROPERTY(BlueprintReadOnly)
TObjectPtr<UWidgetInteractionComponent> WidgetInteractionRight;
UPROPERTY(BlueprintReadOnly)
TObjectPtr<UCameraComponent> Camera;
UPROPERTY(BlueprintReadOnly)
TObjectPtr<UStaticMeshComponent> HeadMountedDisplayMesh;
In the editor I have created a blueprint which inherits from the C++. When I open the bueprint class, I get this mess:
All the properties are unordered and VROrigin
doesn’t appear as the root component.
What’s happening?
Thanks!