Hey,
I’m working on creating my own APawn and UPawnMovementComponent derived classes, and the comments in Pawn.h suggest overriding GetMovementComponent() in classes which have their own movement component. The ACharacter class does exactly that with the following code:
UPROPERTY(Category=Character, VisibleAnywhere, BlueprintReadOnly)
TSubobjectPtr<class UCharacterMovementComponent> CharacterMovement;
virtual class UPawnMovementComponent* GetMovementComponent() const OVERRIDE { return CharacterMovement; }
I’ve attempted to do the same in my AShmupPawn class:
UPROPERTY(Category = ShmupPawn, VisibleAnywhere, BlueprintReadOnly)
TSubobjectPtr<class UShmupPawnMovementComponent> ShmupPawnMovement;
virtual class UPawnMovementComponent* GetMovementComponent() const OVERRIDE{ return ShmupPawnMovement; }
However, when compiling I get the following error:
error C2440: 'return' : cannot convert from 'const TSubobjectPtr<UShmupPawnMovementComponent>' to 'UPawnMovementComponent *'
I’ve looked through the code for ACharacter and UCharacterMovementComponent but I can’t find anything that addresses the issue, and the simple documentation in APawn implies that this should be straightforward. Any ideas?
Thanks.