Tick function does work

i am following the crypt raider section of the unreal engine course

This is my .cpp :

// Fill out your copyright notice in the Description page of Project Settings.

#include "TriggerComponent.h"

// Sets default values for this component's properties

void UTriggerComponent::BeginPlay()

{

    Super::BeginPlay();

    UE_LOG(LogTemp, Display, TEXT("TriggerComponentAlive"));

}

void UTriggerComponent::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)

{

    Super::TickComponent(DeltaTime, TickType, ThisTickFunction);    

   

    TArray<AActor*> Actors;

    GetOverlappingActors(Actors);

    if (Actors.Num() > 0)

    {

        FString OverlappingActor = Actors[0]->GetActorNameOrLabel();

        UE_LOG(LogTemp, Display, TEXT("Overlapping Actor: %s"), *OverlappingActor);

    }

}

and this is my .h :

// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"

#include "Components/BoxComponent.h"

#include "TriggerComponent.generated.h"

/**

 *

 */

UCLASS( ClassGroup=(Custom), meta = (BlueprintSpawnableComponent) )

class CRYPTRAIDER_API UTriggerComponent : public UBoxComponent

{

    GENERATED_BODY()

public:

    UTriggerComponent();

   

protected:

    // Called when the game starts

    virtual void BeginPlay() override;

public:

    // Called every frame

    virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;

}; // Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"

#include "Components/BoxComponent.h"

#include "TriggerComponent.generated.h"

/**

 *

 */

UCLASS( ClassGroup=(Custom), meta = (BlueprintSpawnableComponent) )

class CRYPTRAIDER_API UTriggerComponent : public UBoxComponent

{

    GENERATED_BODY()

public:

    UTriggerComponent();

   

protected:

    // Called when the game starts

    virtual void BeginPlay() override;

public:

    // Called every frame

    virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;

};

i cant fix it in anyway so i come here

What have you attached the trigger component to? Have you tried adding a log just after Super::TickComponent to see if it logs?

Privacy & Terms