Introduction to UE4 Programming - 3 - Creating the Base Pickup Class


Author:

Epic Games

Description:

In this video, we’ll add our first class! This class will be the template for a generic pickup, and we will build on it more in later videos. We’ll also add our first function and variable, and talk about the UCLASS, UFUNCTION, and UPROPERTY macros.

Related Links:


UE 4.6 Changes:

  • "GENERATED_UCLASS_BODY()" macro is now "GENERATED_BODY()". You must also specify the public access manually under "GENERATED_BODY()" by adding "public:" directly under "GENERATED_BODY()".
  • You now need to manually add the constructor "APickup(const FObjectInitializer& ObjectInitializer);" under "public:" in the header file.
  • The constructor in the .cpp file is now: "APickup(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer)", this means you also need to replace all references to "PCIP" with "ObjectInitializer"
  • The SubObject template pointer has been replaced. Use normal pointers now, e.g:
    "class USphereComponent* BaseCollisionComponent;"