C++ to Blueprint

We now have a health and health regeneration system in our character class. One problem with our current system is that we have not yet defined what happens to our character after the health reaches 0. In this section, we will create an event that we will implement in Blueprint. This event will be called when the player's health reaches 0.0. To create this Blueprint event, open our character header file and add the following code:

UFUNCTION(BlueprintImplementableEvent, Category = "My Character")
void PlayerHealthIsZero();

As you can see, we added a normal function called PlayerHealthIsZero(). To make this available in Blueprint, we added a UFUNCTION specifier and inside that we added BlueprintImplementableEvent. This means C++ can ...

Get Unreal Engine 4 Game Development Essentials 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.