How can I set custom CharacterMovementComponent as defaut character component

I try to set it in construct function

	SCharacterMovement = CreateDefaultSubobject<USCharacterMovementComponent>(ACharacter::CharacterMovementComponentName);
	if (SCharacterMovement)
		SCharacterMovement->UpdatedComponent = CapsuleComponent;
		CrouchedEyeHeight = SCharacterMovement->CrouchedHalfHeight * 0.80f;
		CharacterMovement = SCharacterMovement;

is there any safe way to set custom CharacterMovementComponent as defaut character component?

Check out this page. It tells you how to set the character movment component type in c++.

I think it need some update the tutorial

Why do you say that? I haven’t tried it in UE 4.10, but I know it works in UE 4.9. Its the section named UE 4.6 and onward you should look at, it tells you to do something like this:

AMyCharacter::AMyCharacter(const class FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer.SetDefaultSubobjectClass<UCustomCharacterMovementComponent>(ACharacter::CharacterMovementComponentName)) { ... }

I tried it in 4.101 it can’t compile correct

4.10 won’t install for some reason, can’t test.

Ok,I see. I will try, thank u very much