Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Unreal Engine 4 Game Development Quick Start Guide

You're reading from   Unreal Engine 4 Game Development Quick Start Guide Programming professional 3D games with Unreal Engine 4

Arrow left icon
Product type Paperback
Published in May 2019
Publisher Packt
ISBN-13 9781789950687
Length 202 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Rachel Cordone Rachel Cordone
Author Profile Icon Rachel Cordone
Rachel Cordone
Arrow right icon
View More author details
Toc

Using events in C++

Most of the events we've been using, such as BeginPlay and Tick, are called from C++. We've taken a look at how to create our own in Blueprints, and now we'll see how to create them in C++ for use in our own Blueprints.

For this, we will start in the header file. Events are created much the same way our normal and pure functions were, but we use the BlueprintImplementableEvent specifier. We'll also add an output float that we can log:

For this one, we won't implement the function in the .cpp file, so ignore the green line under the function name.

In the .cpp file, we'll add a call to our custom Event in the BeginPlay function to keep it simple. We just need to add one line at the end, and we'll hardcode a value of 256 for the output:

That's all we need for the C++ side of things, so compile the code and head back into...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime