I’m making a custom movement component for a pawn, and for some reason, the TickComponent isn’t firing.
I looked through the Components and Collision tutorial, and pretty much copied their approach with no luck. I even tried deleting all my code, replacing it with the code in the tutorial, and it still didn’t work, so I’m assuming something about the tutorial is out of date with more recent engine versions.
Header File
UCLASS()
class TESTGAME_API UGameMovementComponent : public UPawnMovementComponent
{
GENERATED_BODY()
public:
UGameMovementComponent(const FObjectInitializer& ObjectInitializer = FObjectInitializer::Get());
virtual void SetUpdatedComponent(USceneComponent* NewUpdatedComponent) override;
virtual void TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction) override;
}
Portion of Code File
void UGameMovementComponent::TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction) {
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
if (!PawnOwner || !UpdatedComponent || ShouldSkipUpdate(DeltaTime))
{
return;
}
GEngine->AddOnScreenDebugMessage(1, 5.f, FColor::Red, FString::Printf(TEXT("Some variable values:")));
const FVector InputVector = ConsumeInputVector();
}
and its set with in the constructor of the pawn with
PlayerMovementComponent = CreateDefaultSubobject<UGameMovementComponent>(TEXT("GameMovementComponent"));
PlayerMovementComponent->UpdatedComponent = CapsuleComponent;