When using Unreal Engines built in Custom Movement Component, I understand that in order to set a custom Child of the FSavedMoveCharacter Class as the active FSavedMoveCharacter, the Function AllocateNewMove Is used.
AllocateNewMove() returns a "FSavedMovePtr", so my custom child of the FSavedMoveCharacter must be converted to a "FSavedMovePtr"
When I try to do this using the most common method it fails:
FSavedMovePtr UCustomMoveComponent::FNetworkPredictionData_Client_Custom::AllocateNewMove()
{
return FSavedMovePtr(new FSavedMove_Custom());
}
Using this method, no suitable conversion is found
"cannot convert from 'UCustomMoveComponent::FSavedMove_Custom *' to 'FSavedMovePtr'"
FSavedMovePtr is defined as
typedef TSharedPtr<class FSavedMove_Character> FSavedMovePtr;
It appears that it is defined as a pointer to the FSavedMove_Character class so I cannot understand why converting a child of this class to a pointer would fail
My custom Move component is defined as
class FSavedMove_Custom : FSavedMove_Character
{
typedef FSavedMove_Character Super;
uint8 Saved_WantsToSprint :1;
virtual bool CanCombineWith(const FSavedMovePtr& NewMove, ACharacter* InCharacter, float MaxDelta) const override;
virtual void Clear() override;
virtual uint8 GetCompressedFlags() const override;
virtual void SetMoveFor(ACharacter* C, float InDeltaTime, FVector const& NewAccel, FNetworkPredictionData_Client_Character& ClientData) override;
virtual void PrepMoveFor(ACharacter* C) override;
};
In short, how can the above class be converted to a TSharedPtr of itself?
return MakeShared<FSavedMove_Custom>();