Can't get constructor working

Hi there.
I’m currently on 4.6.1 (I don’t feel like updating) but I’m assuming that it won’t matter that much code-wise. I can’t seem to get it working. I’ve googled a lot but I don’t get any definitive answer about my problem.


#pragma once

#include "GameFramework/Actor.h"
#include "DestroyableActor.generated.h"

class BASEGAME_API ADestroyableActor : public AActor

		ADestroyableActor(const class FObjectInitializer& PCIP);


#include "BaseGame.h"
#include "DestroyableActor.h"

ADestroyableActor::ADestroyableActor(const class FObjectInitializer& PCIP) : Super(PCIP)

This does not seem to compile properly. It gives me errors that don’t make sense like I’m missing a semicolon and stuff like that… and I don’t think that’s the problem.

PCIP has been deprecated and replaced with ObjectInitializer.

This is also true to 4.6.1 I believe. In 4.7, you can have parameter-less constructors as well, useful if your class has no components :slight_smile:

4.6+ Constructor looks like this:


AMyClass(const FObjectInitializer& ObjectInitializer);


AMyClass::AMyClass(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer)

That still didn’t work. I had to changed GENERATED_BODY() to GENERATED_UCLASS_BODY() for the function to compile properly. I kept reading everywhere that it was deprecated, but it won’t compile for me otherwise.
Anyhow, thanks for your response. :smiley: