To be more specific, here's what happens.
For example, music might be going on, or a a speech might be playing.
I then press the Esc button, the pause menu opens, and the sound stops.
However, when I click, for example, on Options, I can hear, for a fraction of a second, the speech (or the music) which goes forward. The same happens when I press Back, etc.
Basically, in the time that it's "loading" the other menu, it keeps playing.
My guess, it's as if, despite the fact that the gameplay should be paused, when it is moving from one menu to the other, it resumes for a tiny second. Any way to prevent this?
To note, I have tried both enabling and disabling the fade effect everywhere.
Comments
Try this: set the Options button's Click type to Run Action List, and then use two Menu: Change state Actions to crossfade the two menus. You can then edit the ActionLists' properties (in it's Inspector) to uncheck Unfreeze 'pause' menus? This should prevent the game from being unpaused for a split-second, and therefore keep the audio muted.
I lost myself in the Actionlist, sorry: what do you mean "to crossfade the two menus"?
The only option that I see there is "Turn on menu", but if I put the Options menu, it will open the options menu over the old menu...
Also, I'm not sure how to get back then, I assume that I have to do the opposite on the "Back" button of the options menu?
I'm really sorry.
The problem also happens when I open the Save and Load menu though, so I guess I have to do the same there too...
If you open up the Menu Manager, select the "Pause" Menu, and the "OptionsButton" element within it, you can edit the menu button that takes you from the Pause to the Options menu. It's default Click type is set to Crossfade, and set to switch to Options. What you want to do is change the Click type to Run ActionList, and then assign a new ActionList that uses two Menu: Change state Actions: one to turn off Pause, and another to turn on Options. So long as you check "Wait until finished?" in the first Action, then the Options menu will not appear before Pause has disappeared. Again, don't forget to uncheck Unfreeze 'pause' menus? in it's properties.
I have also tried to take out the "wait until finished" in the second action but it makes no difference in this case.
Here's a screen of the Actionlist, just to be sure I got it right:
btw, I'm using a sound prefab set to Music with AC's Radio Martini track who plays on Awake to test.
Select the asset (it's in /AdventureCreator/Demo/InvActionLists, and uncheck Unfreeze 'pause' menus? in it's Inspector. It should be that you can go back to crossfading between your menus normally, so I apologise for the hassle with the previous answer.
Just to be clear, I am not using the asset you spoke about because I had already replaced the action that happens when the Menu is turned on with another one. However, mine is only slightly different:
- Deselect Inventory
- Turn Off Inventory (in case it's open)
- Lock Menu (Inventory)
I went and de-checked Unfreeze pause menus anyway but... no change. Unfortunately.
I even thought that maybe something is wrong with my audio setup. I can post a detailed description if needed. However, I just tried to literally copy paste just my char, the music and the terrain into a new scene and the problem still occurs.
It happens only during the menus...
edit: just made a quick try, I took off completely my ActionList that runs when the menu is opened, and the problem still occurs. However, I didn't have the time to test this in a build but only in the editor so take this with a little grain of salt.
So, first I tried it "vanilla version", and the error happens even there.
Then, I tried to make your previous adjustement, and you're right, it seems to be gone.
This had me thinking, and I think I nailed what's the problem.
The problem was the "Temp Resolution" actionlist that's set to run when the options menu opens. I had forgotten about it, and that's why the problem was happening even when I had removed the actionlist that opens when the menu itself opens.
When I removed it, the error is gone. So I just put it back, unchecked "unfreeze pause menus" and voila. Problem solved.
However, I'm confused as to why this was happening in the Save and Load menus, too.
Grrrr Unity....
edit: okay, *sigh* actually, I still heard the audio for a fraction of a second again when I clicked on "quit" (lol?) but honestly I don't really care anymore about that.