Download

Cant call BeginPlay() and TickComponent() on UActorComponent

Hello, I add ActorComponent to StaticMeshActor via add component wizard->new cpp component, further I want print log message from BeginPlay() but fired only constructor of ActorComponent.

What am I doing wrong?

Capture.JPG



#include "OpenDoor.h"

UOpenDoor::UOpenDoor()
{
   PrimaryComponentTick.bCanEverTick = true;

   AActor* Parent = GetOwner();

   if (Parent)
   {
      UE_LOG(LogTemp, Warning, TEXT("if (Parent) = %s"), *Parent->GetName()); // OK
   }


}

void UOpenDoor::BeginPlay()
{
   Super::BeginPlay();

   UE_LOG(LogTemp, Warning, TEXT("UOpenDoor::BeginPlay()")); // dont print ?
}

void UOpenDoor::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
{
   Super::TickComponent(DeltaTime, TickType, ThisTickFunction);

   UE_LOG(LogTemp, Warning, TEXT("UOpenDoor::TickComponent()"));
}