Hallo everybody) I’ve faced with this problem, and I can’t solve it. This’s PickupItem.h
#pragma once
#include "GameFramework/Actor.h"
#include "PickupItem.generated.h"
UCLASS()
class PROTOTIP1_API APickupItem : public AActor
{
GENERATED_BODY()
public:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Item)
FString Name;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Item)
int Quantity;
UPROPERTY(VisibleDefaultsOnly, BlueprintReadOnly, Category = Item)
USphereComponent* ProxSphere;
UPROPERTY(VisibleDefaultsOnly, BlueprintReadOnly, Category = Item)
UStaticMeshComponent* Mesh;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Item)
UTexture2D* Icon;
UFUNCTION(BlueprintNativeEvent, Category = Collision)
void Prox(class UPrimitiveComponent* HitComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult & SweepResult);
};
This’s PickupItem.cpp
#include "prototip1.h"
#include "PickupItem.h"
APickupItem::APickupItem(const class FObjectInitializer& PCIP) : Super(PCIP)
{
Name = "UNKNOWN ITEM";
Quantity = 0;
ProxSphere = PCIP.CreateDefaultSubobject<USphereComponent>(this, TEXT("ProxSphere"));
Mesh = PCIP.CreateDefaultSubobject<UStaticMeshComponent>(this, TEXT("Mesh"));
RootComponent = Mesh;
Mesh->SetSimulatePhysics(true);
ProxSphere->OnComponentBeginOverlap.AddDynamic(this, &APickupItem::Prox);
ProxSphere->AttachTo(Mesh);
}
void APickupItem::Prox(class UPrimitiveComponent* HitComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult & SweepResult)
{
int a = 2;
}
And here’re errors (from “…Rebuild.bat” prototip1Editor Win64 Development “…\prototip1.uproject” -waitmutex")
[code] …\Source\prototip1\PickupItem.cpp(7): errorC2084: function “APickupItem::APickupItem(const FObjectInitializer &)” already has
the text of the implementation
…\Source\prototip1\PickupItem.cpp(20): warning C4996: ‘USceneComponent::AttachTo’: This function is deprecated, please use AttachToComponent instead. Please update your code to the new API before upgradin
g to the next release, otherwise your project will no longer compile.
[/code]
VS write MSB3073 and other compilation error (5). Thanks in advance