While our game may be running without any issues in the editor or even in…
EndPlay Function Explanation
Some times you want some custom functionality happen in an Actor when you exit your game. Unreal Engine provides a built-in function which is fired when yout exit your game.
Calling the EndPlay Function
In order to call the EndPlay function from an object you first need to override it. To do that, go to the header file of your declared C++ class of the Actor of your choice and type in the following function definition:
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
Now, switch to your source file, and type in the following function:
Note 1: The name of your Actor class may vary so be sure to change it if you copy paste the code above
Note 2: The log will be displayed when you exit your viewport after playing your game.
This Post Has 0 Comments