Creating a UInterface

UInterfaces are a pair of classes that work together to enable classes to exhibit polymorphic behavior among multiple class hierarchies. This recipe shows you the basic steps involved in creating a UInterface purely in code.

How to do it...

  1. UInterfaces don't show up inside the main class wizard within Unreal, so we'll need to add the class manually using Visual Studio.
  2. Right click on your Source folder inside Solution Explorer, and select Add | New Item.
  3. Select a .h file to start, and name it MyInterface.h.
  4. Make sure you change the directory for the item to be placed in from Intermediate to Source/ProjectName.
  5. Click on OK to create a new header file in your project folder.
  6. Repeat the steps in order to create MyInterface.cpp as your ...

Get Unreal Engine 4 Scripting with C++ Cookbook 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.