TArray not working

After fighting with the tick not ticking all morning, I finally got that sorted out. The correct header files are attached.

I have tried Updating the project from the editor, closing and rebuilding from VS Code, adding and removing the component.


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

#include "TriggerCompononet.h"

    // 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.
	PrimaryComponentTick.bCanEverTick = true;

	// ...

void UTriggerCompononet::BeginPlay()

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

    UE_LOG(LogTemp, Display, TEXT("TickComponent called"));

    TArray<AActor *> OverlappingActors;

    if(OverlappingActors.Num() > 0)
        FString ActorName = OverlappingActors[0]->GetActorNameOrLabel();
        UE_LOG(LogTemp, Error, TEXT("Overlapping with %d actors"), *ActorName);



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

#pragma once

#include "CoreMinimal.h"
#include "Components/BoxComponent.h"
#include "TriggerCompononet.generated.h"

UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent))
class GDTV_CRYPTGAME_API UTriggerCompononet : public UBoxComponent

	// Sets default values for this component's properties
	// Called when the game starts
	virtual void BeginPlay() override;
	// Called every frame
	virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;

In what sense is it not working?

Sorry, I have only just gotten back to work on this. For some reason I have yet to figure out, Unreal keeps disassociating the components. I ended up having to delete them and add them back. This is still an ongoing issue. But because Unreal wasn’t seeing them, the arrays weren’t firing either.

Could you elaborate on what you mean by this?

Privacy & Terms