Make ACharacter Use Inherited UCharacterMovementCompenent

Hi, I made a Class that has UCharacterMovementComponent as it’s parent, I did this so that I could override one of its functions to implement custom functionality like so:

UCLASS()
class MYMIRRORING_API USuperCharacterMovementComponent : public UCharacterMovementComponent
{
	GENERATED_BODY()
protected:
	virtual void PerformMovement(float DeltaTime) override;

public:
	UPROPERTY(Category = "Character Movement: Mirror", EditAnywhere, BlueprintReadWrite)
	bool MirrorRootMotion;
	
	UPROPERTY(Category = "Character Movement: Mirror", EditAnywhere, BlueprintReadWrite)
		TEnumAsByte<EAxis::Type> MirrorAxis;

	UPROPERTY(Category = "Character Movement: Mirror", EditAnywhere, BlueprintReadWrite)
		TEnumAsByte<EAxis::Type> FlipAxis;
};

But now I dont know how to specify to an ACharacter to have USuperCharacterMovementComponent instead of UCharacterMovementComponent, any help will be apreciated.

You need to use the FObjectInitializer passed to the constructor:

UCLASS()
class ANSWERHUB_API AMovementCharacter : public ACharacter
{
	GENERATED_BODY()

public:
	AMovementCharacter(const FObjectInitializer& ObjectInitializer = FObjectInitializer::Get());
	
};

AMovementCharacter::AMovementCharacter(const FObjectInitializer& ObjectInitializer /*= FObjectInitializer::Get()*/)
	: Super(ObjectInitializer.SetDefaultSubobjectClass<UMyCharacterMovementComponent>(ACharacter::CharacterMovementComponentName))
{
}

Then your characters will have the custom movement component:

Nice! Thanks a lot.