Unreal Engine 4.x Scripting with C++ Cookbook - Second Edition
by John P. Doran, William Sherif, Stephen Whittle
How it works...
Inside our GameMode header, we declare a type of delegate that doesn't take any parameters, called FStandardDelegateSignature. We then create an instance of the delegate as a member of our GameModeBase class.
We add a PointLight component inside of the DelegateListener so that we have a visual representation of the delegate being executed that we can turn on later on. In the constructor, we initialize our PointLight, and then disable it. To make it easier to see, we also change the color to blue.
We override BeginPlay. We first call the parent class's implementation of BeginPlay(). Then, we get the game world, retrieving the GameMode class using GetGameMode(). Casting the resulting AGameMode* to a pointer of our GameMode
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access