I wanna make a class which spawns different non static meshes depending on what a variable is set equal to. So far I have the following code:
.h
#pragma once
#include "Pickup.h"
#include "Stuff.generated.h"
UCLASS()
class AStuff : public APickup {
GENERATED_UCLASS_BODY()
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Pickup)
FString bThing;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Pickup)
float bAmount;
void OnPickedUp();
};
.cpp
#include "../KK_Survival.h"
#include "Stuff.h"
AStuff::AStuff (const class FPostConstructInitializeProperties& PCIP) : Super(PCIP) {
bThing = "Food";
if (bThing == "Food") {
//create mesh
}
else if (bThing == "Drink") {
//create mesh
}
else if (bThing == "MedKit") {
//create mesh
}
else {
//create mesh
}
}
void AStuff::OnPickedUp() {
Super::OnPickedUp();
Destroy();
}
The Stuff class’ base class is Pickup and the Pickup class’ base class is Actor. I am quite new to UE4 so could someone explain to me what I have actually written down (only te engine relative stuff, not the basic C++ stuff).