Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

How can I keep Audio from losing focus when not in Editor?

Hello. I have an Ambient looping Audio playing in my game, but it only plays when I click the game window. When I have my mouse click somewhere off screen, it stops playing. I know this is probably an issue with OnFocus. Is there a way in Blueprint to play the Audio continuously, even when the game is NOT in focus?

Product Version: Not Selected
more ▼

asked Jul 09 '14 at 02:31 PM in Blueprint Scripting

avatar image

53 5 5 11

avatar image Ari2000 Jul 10 '14 at 06:45 PM

I know Unity has an Application.OnFocus function that sends an event for the game being onfocus or not. I am looking for a way to do something similar- hopefully just setting music to keep playing EVEN when the game is not in focus.

avatar image TorQueMoD May 16 '16 at 02:56 AM

Just out of curiosity, why would you want to do this? Personally I find it irritating when I minimize a game and its audio keeps playing.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

This has been moved to the Engine.ini file as of 4.6:

 GConfig->GetFloat(TEXT("Audio"), TEXT("UnfocusedVolumeMultiplier"), UnfocusedVolumeMultiplier, GEngineIni);

In the DefaultEngine.ini or any of the Engine config files where you would need to change this just set:

more ▼

answered Aug 16 '15 at 04:37 AM

avatar image

383 8 133 45

avatar image Luanrs Jun 17 '16 at 04:00 AM

If the Engine is open you'll need to restart ir for the changes take effect.

avatar image jmcorallo Mar 06 '17 at 09:59 PM

Hi, do you know if this works for mobile devices too? (iOS & Android)

avatar image Kory Mar 06 '17 at 11:10 PM

No, I don't know, please post your findings for others. Thanks!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

If anyone is still wondering, I figured it out!

The engine automatically mutes itself whenever the window is not focused.

In WindowsPlatformMisc.cpp:

// if its our window, allow sound, otherwise silence it GVolumeMultiplier = HasFocus ? 1.0f : 0.0f;

All I did was comment out that line and viola- it works!

more ▼

answered Jul 14 '14 at 06:12 PM

avatar image

53 5 5 11

avatar image keru Jul 19 '14 at 05:15 PM

Hi So it's needed a full recompilation of the Engine or it's enough to override that function somewhere in my project?

avatar image Ari2000 Jul 19 '14 at 05:21 PM

Yes, after you comment out that line, you will need to recompile your code in order for it to work. I was never able to find a way in Blueprint to do it.

So, comment out that line of code, recompile, then you should be good to go.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question