Lesson on Constructors, problem with TickComponent

I’m doing the lesson with constructors in the cryptraider section. I simply can’t get the ulog message in the TickComponent to print in the output log, so I have no idea if the trigger component is actually working as it should.

This is my TriggerComponent.h:


#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:
    virtual void BeginPlay() override;

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

And this is my TriggerComponent.cpp:


#include "TriggerComponent.h"

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

    UE_LOG(LogTemp, Warning, TEXT("Trigger Component Is Active"));
}

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

    UE_LOG(LogTemp, Warning, TEXT("Trigger Component Is Alive"));
}

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

    UE_LOG(LogTemp, Warning, TEXT("Trigger Component Is Ticking"));
}

The ulog messages is the constructor and BeginPlay shows up in the output log, but not the ulog message in the TickComponent. Why?

Does it tick if you add it to another actor?

Yes, it does. I added the trigger component to a static mesh pillar and it started to tick. But the BP_SecretWall that’s supposed to have the component does not.

Hm… I added a second trigger to the BP_SecretWall and then it ticks! But when trying to remove the first one I get the message:

“Component “Trigger” has bound events in use! If you delete it then those nodes will become invalid. Are you sure you want to delete it?”

Can someone explain what’s going on here?

Edit: I don’t get this message when deleting other triggers that I add. Can I delete the first one despite the message or will I mess things up?

Good day

I just had the same issue. The error message is related to the blueprint “On Component Begin Overlap”. You can safely delete the first Trigger component, add the second one and then you will also need to delete the blueprint giving the error and add it again using the newly added Trigger Component and reconnect the pins to Get Display Name and Print String. This seems to have fixed the issue and the Tick Component is working now. I am using Unreal Engine 5.2.1 and it seems to be a bug or something.

Thanks for the answer. I eventually found out the same thing, except I didn’t delete the whole blueprint. I just removed the first trigger component, and remade the “on component begin overlap” on the new trigger component. I also closed the editor and built everything from vscode. Then in the editor I went to Tools → Refresh Visual Studio Code Project. Just seems like something one has to do from time to time.

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms