How to do it...

The first step in creating our collectible would be to actually create the class we are going to use:

  1. Navigate to File | New C++ Class and from there, in the Choose Parent Class window, select Actor and then click on Next:
  1. From the next window, set the Name property to CollectibleObject and click on the Create Class button to add it to the project and compile the base code:
  1. Once Visual Studio opens up, update CollectibleObject.h to the following:
#pragma once#include "CoreMinimal.h"#include "GameFramework/Actor.h"#include ...

Get Unreal Engine 4.x Scripting with C++ Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.