# Exit Game Function?

**URL:** <https://forums.unrealengine.com/t/exit-game-function/299303>\
**Category:** Blueprint\
**Tags:** autosave, unreal-engine, Blueprint, question\
**Created:** [November 18, 2014, 9:30pm UTC](https://forums.unrealengine.com/t/exit-game-function/299303 "2014-11-18T21:30:37Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_0599cf61](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_0599cf61](https://forums.unrealengine.com/u/anonymous_user_0599cf61)\
**Post date:** [November 18, 2014, 9:30pm UTC](https://forums.unrealengine.com/t/exit-game-function/299303/1 "2014-11-18T21:30:37Z")

</div>

I want to save the player progress when he exit the Game in Standalone version or left the Editor Preview Version…I know how save Variables in a Save game object…but I don’t find a function that **fire a event when the game is closed**

---

<div class="post-metadata">

**Author:** ![afuzzyllama](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@afuzzyllama](https://forums.unrealengine.com/u/afuzzyllama)\
**Post date:** [April 18, 2015, 4:16pm UTC](https://forums.unrealengine.com/t/exit-game-function/299303/2 "2015-04-18T16:16:29Z")

</div>

You’ll need to create your own Game Module (like a plug in) and then implement the `ShutdownModule` method. Follow the `FDefaultGameModuleImpl` to get started.

I’m not sure if you can implement a game module with blueprints.

---

<div class="post-metadata">

**Author:** ![buscas31](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@buscas31](https://forums.unrealengine.com/u/buscas31)\
**Post date:** [August 12, 2015, 11:58am UTC](https://forums.unrealengine.com/t/exit-game-function/299303/3 "2015-08-12T11:58:24Z")

</div>

I suggest you to use “Save Points” (like dead space save points) with triggers and store the save points to save game . Is a lot easy to do this in that way.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_0599cf61](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_0599cf61](https://forums.unrealengine.com/u/anonymous_user_0599cf61)\
**Post date:** [August 19, 2015, 1:15pm UTC](https://forums.unrealengine.com/t/exit-game-function/299303/4 "2015-08-19T13:15:49Z")

</div>

Nice ideia…another i had this morning is create a button on my pause menu…check for the latest save and save minor things like ammo…or life…

---

<div class="post-metadata">

**Author:** ![dawnarc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@dawnarc](https://forums.unrealengine.com/u/dawnarc)\
**Post date:** [April 13, 2016, 4:02am UTC](https://forums.unrealengine.com/t/exit-game-function/299303/5 "2016-04-13T04:02:56Z")

</div>

virtual void BeginDestroy() override;

```
void AMyGameMode::BeginDestroy()
{
	Super::BeginDestroy();
	
	...
	your logic code...
	...
}
```

---

<div class="post-metadata">

**Author:** ![hexcola](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@hexcola](https://forums.unrealengine.com/u/hexcola)\
**Post date:** [April 24, 2017, 3:33am UTC](https://forums.unrealengine.com/t/exit-game-function/299303/6 "2017-04-24T03:33:15Z")

</div>

I think this is the same question as **[Event on Close](https://answers.unrealengine.com/questions/127897/event-on-close.html)** and **[call function before quit game](https://answers.unrealengine.com/questions/364334/call-function-before-quit-game.html)**.

the basic idea is you need to create a subclass of **UEngine** and override it’s **PreExit** function or create a subclass of **UGameInstance** and override its **Shutdown** function
