Initialize WheeledVehicleMovementComponent

Hello!

For the project I am currently working on I need wheeled vehicles. I am not using the WheeledVehicle class because I want all of my different vehicle types (cars, planes, helis etc) to derive from the same base class.

I noticed that UWheeledVehicleMovementComponent is abstract and cannot be initialized with CreateDefaultSubobject,
so I tried CreateAbstractDefaultSubobject. It allows the code compile and start up the editor, however I do not see the component on child Blueprints (this is not a problem of the blueprint accessability) and in the defaults tab the component name is listed with some kind of string value which is set to “None”.

So does anyone know how to initialize an abstract component?

Thanks!

PS.: I wanted to have a look at the WheeledVehicle constructor but it isn’t visible in the API documentation.

AWheeledVehicle constructor:

FName AWheeledVehicle::VehicleMovementComponentName(TEXT("MovementComp"));
    
FName AWheeledVehicle::VehicleMeshComponentName(TEXT("VehicleMesh"));
    
AWheeledVehicle::AWheeledVehicle(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer)
{
  Mesh = ObjectInitializer.CreateDefaultSubobject<USkeletalMeshComponent>(this, VehicleMeshComponentName);
  Mesh->SetCollisionProfileName(UCollisionProfile::Vehicle_ProfileName);
  Mesh->BodyInstance.bSimulatePhysics = true;
  Mesh->BodyInstance.bNotifyRigidBodyCollision = true;
  Mesh->BodyInstance.bUseCCD = true;
  Mesh->bBlendPhysics = true;
  Mesh->bGenerateOverlapEvents = true;
  Mesh->bCanEverAffectNavigation = false;
  RootComponent = Mesh;

  VehicleMovement = ObjectInitializer.CreateDefaultSubobject<UWheeledVehicleMovementComponent, UWheeledVehicleMovementComponent4W>(this, VehicleMovementComponentName);
  VehicleMovement->SetIsReplicated(true); // Enable replication by default
  VehicleMovement->UpdatedComponent = Mesh;
}

UWheeledVehicleMovementComponent4W declaration:

UCLASS()
class ENGINE_API UWheeledVehicleMovementComponent4W : public UWheeledVehicleMovementComponent

There are a lot of code inside UWheeledVehicleMovementComponent4W. You can download all this files from GitHub.

Thanks wamsk! I know that I could have downloaded the source code but I didn’t want to do that just for on single line of code…

For whoever is also interested in the solution, here is how it should look like in the header and code file:

UPROPERTY(BlueprintReadOnly, VisibleAnywhere, Category = Components)
			TSubobjectPtr<UWheeledVehicleMovementComponent> VehicleMovement;


VehicleMovement = PCIP.CreateDefaultSubobject<UWheeledVehicleMovementComponent, UWheeledVehicleMovementComponent4W>(this, TEXT("VehicleMovement"));

Code from header:

UPROPERTY(Category = Vehicle, VisibleDefaultsOnly, BlueprintReadOnly)
class UWheeledVehicleMovementComponent* VehicleMovement;