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?
The question doesn’t seem to be related to FMOD, but rather to Unity.
The solution:
- Subscribe on
wantsToQuit
event. Event handler should returnfalse
on first hit. - On
Alt+F4
this event will be triggered, start sound fadeout and timer to quit app. - When fadeout finished or timer expired, call
Quit
, this also triggerswantsToQuit
again. - On the second hit event handler should return
true
.
See Application.wantsToQuit and Application.Quit
Hope this helps!