Advanced custom movement class (for Flying)

Hello again, i dont need any help i just wanted to add the correction to this code that i found, as i think there is a slight syntax error, the code that worked for me was

AMyCharacter::AMyCharacter(const FObjectInitializer& ObjectInitializer)
	: Super(ObjectInitializer.SetDefaultSubobjectClass<UMyMovementComponent>(ACharacter::CharacterMovementComponentName))
{
  ...constructor body, if any...
}

I discovered this as there is this line in the character.h file

/** Name of the CharacterMovement component. Use this name if you want to use a different class (with ObjectInitializer.SetDefaultSubobjectClass). */
static ENGINE_API FName CharacterMovementComponentName;

Maybe this is useful if someone is debugging a similar issue, although it looks like you cant edit old posts? Hopefully this reply is visible enough

1 Like