# Alt F4 to sound fade out...Could such a feature exist?

**URL:** https://qa.fmod.com/t/alt-f4-to-sound-fade-out-could-such-a-feature-exist/21032
**Category:** FMOD Studio
**Tags:** unity
**Created:** [December 26, 2023, 2:44am UTC](https://qa.fmod.com/t/alt-f4-to-sound-fade-out-could-such-a-feature-exist/21032 "2023-12-26T02:44:44Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Militia](https://avatars.discourse-cdn.com/v4/letter/m/87869e/32.png) [@Militia](https://qa.fmod.com/u/Militia)
#### Post date: [December 26, 2023, 2:44am UTC](https://qa.fmod.com/t/alt-f4-to-sound-fade-out-could-such-a-feature-exist/21032/1 "2023-12-26T02:44:44Z")

</div>

Since Alt + F4 is a system shortcut command, entering this command will immediately terminate the program. However, in the case of the recently released Tekken 8, when you press Alt + F4, the sound fades out with a grace period of about 0.5 seconds. Does anyone know the middleware or production method related to this?

---

<div class="post-metadata">

### Author: ![demiurghg](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/demiurghg/32/5924_2.png) [@demiurghg](https://qa.fmod.com/u/demiurghg)
#### Post date: [December 26, 2023, 11:50am UTC](https://qa.fmod.com/t/alt-f4-to-sound-fade-out-could-such-a-feature-exist/21032/2 "2023-12-26T11:50:45Z")

</div>

The question doesn’t seem to be related to FMOD, but rather to Unity.

The solution:

1. Subscribe on `wantsToQuit` event. Event handler should return `false` on first hit.
2. On `Alt+F4` this event will be triggered, start sound fadeout and timer to quit app.
3. When fadeout finished or timer expired, call `Quit`, this also triggers `wantsToQuit` again.
4. On the second hit event handler should return `true`.

See [Application.wantsToQuit](https://docs.unity3d.com/ScriptReference/Application-wantsToQuit.html) and [Application.Quit](https://docs.unity3d.com/ScriptReference/Application.Quit.html)

Hope this helps!
