I am struggling with a new component, just created a c++ class based on ActorComponent.
I inserted a UE_LOG into the tick.
I do not get one log message at all
BeginPlay is called once when i log it, the tick never.
Any ideas how to get this tick ?
.cpp:
#include “BattleTank.h”
#include “TestComponent.h”
// Sets default values for this component’s properties
UTestComponent::UTestComponent()
{
// Set this component to be initialized when the game starts, and to be ticked every frame. You can turn these features
// off to improve performance if you don’t need them.
bWantsBeginPlay = true;
PrimaryComponentTick.bCanEverTick = true;
// ...
}
// Called when the game starts
void UTestComponent::BeginPlay()
{
Super::BeginPlay();
// ...
}
// Called every frame
void UTestComponent::TickComponent( float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction )
{
Super::TickComponent( DeltaTime, TickType, ThisTickFunction );
UE_LOG(LogTemp, Warning, TEXT(“TickComponent4”))
// …
}
.h
#pragma once
#include “Components/ActorComponent.h”
#include “TestComponent.generated.h”
UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class BATTLETANK_API UTestComponent : public UActorComponent
{
GENERATED_BODY()
public:
// Sets default values for this component’s properties
UTestComponent();
// Called when the game starts
virtual void BeginPlay() override;
// Called every frame
virtual void TickComponent( float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction ) override;
};