What is the PCIP?

Hello, I am new to UE4 but currently following the official programming tutorial.
I made it to part 18…but I finally need to ask what exactly is this PCIP? It seems to be some kind of factory…but I cant find it in the Object library.

Another thing…why does my IntelliSense take 5 seconds I until I get info on UE4 stuff? :frowning:

It’s the Pineapple Cucumber Intelligent Parsnip

I had to look a long time in the code base to finally figure this out

Rama

PS: welcome to Answerhub!

…I am serious about it…I do not know what the PCIP is…so, can somebody give me a serious answer please?

You can see what it stands for by reading the tooltip when hovering the mouse over the PCIP variable in Visual Studio, or reading a constructor definition :slight_smile: It stands for Post Construct Initialize Properties

PCIP is the name of a variable. It is a pointer to an object of type FPostConstructInitializeProperties. From what I gather, it is a required parameter in any object that subclasses UObject. My guess is that the engine assumes that for any UObject that it wants to create, it will contain a constructor definition that accepts an FPostConstructInitializeProperties as a parameter. Since all objects essentially derive from UObject, you will see PCIP everywhere. Within your constructor, you can access the functions of PCIP with the dot notation to do some post-initialization stuff.

I’m guessing that this is what helps to provide all the introspection/polymorphic goodness in the engine.

If you look at an example of usage:

AMyActor::AMyActor(const class FPostConstructInitializeProperties& PCIP)
    : Super(PCIP)

you can see that it is const. You can also see that prior to executing the constructor code, Super is initialized with the same PCIP. I don’t think you will ever need to create a PCIP to pass to your object. This is something that should be handled by the engine and passed to your constructor when your object is created. You just need to make sure your object’s constructor can pass it along to the next level up.

Oh Rama!
Never disappointed in your answers! :smiley:

haha and furthermore PCIP is going away in 4.6 :slight_smile:

Nice to hear from you zeOrb!

Rama

Thank you, I spent ages looking for this. I was confused when I saw DigitalPickleModule derived from both PCIP and Vinegar, but it all makes sense now.

Just a small addition to this old post. Most of you will probably have noticed already, but if your c++ class contains two constructor, one with PCIP, one without, the engine will only use the one with PCIP when instancing this object.

Simple example:

#define print(text) if (GEngine) GEngine->AddOnScreenDebugMessage(-1, 15, FColor::White, text)

AUser::AUser()
{
	print("initialized WITHOUT PCIP");
}

AUser::AUser(const class FObjectInitializer &PCIP) : Super(PCIP) 
{
	print("initialized WITH PCIP");
}

The engine will only display “initialized WITH PCIP”, so the first constructor is ignored by default