Download

Help!!

First Id like to know how I can learn more about C++ Programming in UE4.

Second What is wrong with the code

PickupMesh->AttachToComponent(PickupRoot, FAttachmentTransformRules::KeepWorldTransform);

My Code:


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

#include "YT.h"
#include "Pickup.h"


// Sets default values
APickup::APickup()
{
 	// 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;
    
    PickupRoot = CreateDefaultSubobject<USceneComponent>(TEXT("PickupRoot"));
    RootComponent = PickupRoot;

    PickupMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("PickupMesh"));
    PickupMesh->AttachToComponent(PickupRoot, FAttachmentTransformRules::KeepWorldTransform);
    
    PickupBox = CreateDefaultSubobject<UBoxComponent>(TEXT("PickupBox"));
    PickupBox->SetWorldScale3D(FVector(1.0f, 1.0f, 1.0f));
}

// Called when the game starts or when spawned
void APickup::BeginPlay()
{
	Super::BeginPlay();
	
}

// Called every frame
void APickup::Tick( float DeltaTime )
{
	Super::Tick( DeltaTime );

}

void APickup::OnPlayerEnterPickupBox(UPrimitiveComponent* OverlappedComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
{
    Destroy();
}


What is the error you are getting when you try compile this code?

Use Of Undeclared ‘FAttachmentTransformRules’ on line “PickupMesh->AttachToComponent(PickupRoot, FAttachmentTransformRules::KeepWorldTransform);”