How to do it...

  1. Click on File | Add C++ Class.... Choose to derive from GameplayTask. To do so, you must first tick Show All Classes, and then type gameplaytask into the filter box. Click on Next:
  1. Name your C++ class (something like GameplayTask_TaskName is the convention), then add the class to your project. The example spawns a particle emitter and is called GameplayTask_CreateParticles:
  1. Once your GameplayTask_CreateParticles.h and .cpp pair are created, navigate to the .h file and update the class to the following:
#pragma once#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.