Hello All,
Decided to get my feet wet with game designing, and I’m having a few struggles thus far. I’m working on completing the APickup introduction that’s on Youtube, and I’m getting a error to which I just can’t seem to solve. Note: I am use 4.7.
Below is my code, and the 2 errors I keep running into to are
- Error 6 error C2535: ‘APickup::APickup(const FObjectInitializer &)’ : member function already defined or declared
Pickup.h
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "GameFramework/Actor.h"
#include "Pickup.generated.h"
UCLASS()
class MYPROJECTTUTORIAL_API APickup : public AActor
{
GENERATED_UCLASS_BODY()
public:
// True when the pickup is able to be picked up, false if soemething deactives the pickuped.
UPROPERTY(EditAnywhere, BluePrintReadWrite)
bool bIsActive;
//Simple collision primitive to use as the root component.
UPROPERTY(VisibleDefaultsOnly, BluePrintReadOnly)
class USphereComponent* BaseCollisionComponent;
// StaticMeshComponent to represent the pickup in the level.
UPROPERTY(VisibleDefaultsOnly, BluePrintReadOnly)
class UStaticMeshComponent* PickupMesh;
//Function to call when the pickup is collected.
UFUNCTION(BlueprintNativeEvent)
void OnPickedUp();
// Sets default values for this actor's properties
APickup(const FObjectInitializer& ObjectInitializer);
// Called when the game starts or when spawned
virtual void BeginPlay() override;
// Called every frame
virtual void Tick( float DeltaSeconds ) override;
};
Pickup.cpp
// Fill out your copyright notice in the Description page of Project Settings.
#include "MyProjectTutorial.h"
#include "Pickup.h"
// Sets default values
APickup::APickup(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
// 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;
//The pickup is valid when it is created
bIsActive = true;
BaseCollisionComponent = ObjectInitializer.CreateDefaultSubobject<USphereComponent>(this, TEXT("BaseSphereComponent"));
RootComponent = BaseCollisionComponent;
PickupMesh = ObjectInitializer.CreateDefaultSubobject<UStaticMeshComponent>(this, TEXT("PickupMesh"));
PickupMesh->SetSimulatePhysics(true);
PickupMesh->AttachTo(RootComponent);
PrimaryActorTick.bCanEverTick = true;
}
void APickup::OnPickedUp_Implementation()
{
//There is no default behavior for the pickup
}
// Called when the game starts or when spawned
void APickup::BeginPlay()
{
Super::BeginPlay();
}
// Called every frame
void APickup::Tick( float DeltaTime )
{
Super::Tick( DeltaTime );
}
Thanks for your help in advance.