I’ve used this tutorial(Unreal Engine C++ Tutorial #3 - Making a game! - YouTube) and exactly same code doesnt work for me.
.CPP FILE:
AMyActor::AMyActor()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
tBox = CreateDefaultSubobject<UBoxComponent>(TEXT("Box"));
tBox->bGenerateOverlapEvents = true;
RootComponent = tBox;
tBox->OnComponentBeginOverlap.AddDynamic(this, &AMyActor::OnBeginOverlap);
meshas = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("meshas"));
meshas->AttachTo(RootComponent);
SpeedScale = 0.0f;
}
void AMyActor::OnBeginOverlap(class AActor* OtherActor, class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult) {
OtherActor->SetActorLocation(Sizeation);
}
HEADER:
UPROPERTY(EditAnywhere)
UShapeComponent* tBox;
UPROPERTY(EditAnywhere)
UStaticMeshComponent* meshas;
UPROPERTY(EditAnywhere, Category = "Testing")
float SpeedScale;
float RunningTime;
FVector StartingLocation = FVector(-91.0f, -1719.0f, 270.0f);
FVector Sizeation = FVector(1.5f, 1.5f, 1.5f);
UFUNCTION()
void OnBeginOverlap(class AActor* OtherActor, class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult);
Error: http://i.imgur.com/eRhRlEr.png
P.S. Line 15 is OnComponentBeginOverlap