I am learning C++, and am wondering how I could adapt an older tutorials code to a modern engine.
I already fixed the issues with TScriptPtr, by adding the regular pointer instead.
The issue I am having, is that these FPost and PCIP classes are not generated from the C++ class generator.
So writing it in a separate declaration is not working.
Here is a link to the tutorial, if it’s confusing.
Here is the code I am trying to get work, and I am using UE4 4.23, and this code is very old.
#include "AmmoCrate.h"
#include "FPSProject.h"
#include "FPSProjectCharacter.h"`enter code here`
// Sets default values
AAmmoCrate::AAmmoCrate()
{
// 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;
}
/*
AAmmoCrate::AAmmoCrate(const class FPostConstructInitializeProperties& PCIP)
: Super(PCIP)
{
count = 30;
TouchSphere = PCIP.CreateDefaultSubobject<USphereComponent>(this, TEXT("TouchSphereComponent"));
TouchSphere->SetSphereRadius(45.f, false);
TouchSphere->OnComponentBeginOverlap.AddDynamic(this, &AAmmoCrate::OnPickup);
RootComponent = TouchSphere;
StaticMesh = PCIP.CreateAbstractDefaultSubobject<UStaticMesh>(this, TEXT("StaticMeshComponent"));
StaticMesh->AttachParent = RootComponent;
}
*/