Forum rules - please read before posting.

Audio One-Shots stop hearing after Loading the game (Last AC versions)

So, I did not have this problem in the previous public build of the game made with AC 1.6x (sorry can't remember the exact version)

I published a build with 1.72 and later I noticed the problem. I updated to 1.75 to see if it was fixed, but no.

All sounds based in "play one shoot" (which I left position (optional) blank), stop being heared after loading the game. Going to a new scene from that loaded game doesn't solve the issue.

The One-shots works on a new game. If I insert myself in any level via Unity Editor, all One-Shots work. if I save a game and load it, they stop being heared. If I load an old save (from previous versions), the same ocurrs. Can't hear One-Shots.

Menu sounds, Music tracks, Ambience tracks, speech scroll audio text, all that work fine.

The One shots appear at the same position when I can hear them as when I can't hear them (meaning that position should not be the problem)
This happens with One Shots triggered via Scene Action lists and Asset Action lists (for some extra menu sounds related, where I cannot set which Sound Gameobject should trigger it)

(I guess the problem may have something to do with the audio listener? I tried disabling it and reenabling it after loading a game, doesn't work. well, stops the music etc, but doesn't make the play one-shots heareable again).

My only audio listener is on the Main Camera. (That has the default sound of the scene attached to it). I'm taking there is no problem with sounds coming from that AC SFC sound gameobject.

Player is an "Empty object" with no audio listener.

I made a test: Making one of the Play One Shots sounds of movement (like clicking on some stairs) play on the Default Sound of the Scene instead of none, and still, works on new game, but not after load.

This is quite an issue and should have been detected by other users (taking in consideration the first time I encountered the bug was on 1.72) so I'm getting it may be related with something on my specific settings... So if you can't reproduce, just ask what screenshots you need to take a look, because I don't know where to look.

I wonder if is about some new Settings on the Game Editor that I should check about... but the strange thing is that all those sounds work as always worked on new games /insert into the level via editor but stop working after loading a game.

BTW/Unrelated?: I'd like to ask what the Cache Main.camera variable does, because when troubleshoting (for example that time scroll audio stops working sometimes) I put it on/off and I don't want to make a mess.. and didn't found documentation about it at the time.

Comments

  • I'm assuming you're referring to v1.71.2 and v1.71.5 - the latter being the latest release.

    I can't reproduce the problem - are you switching scenes when loading, or does reloading the same scene cause the issue?

    Check the Hierarchy window at the time - is the audio appearing as a temporary GameObject, despite not being able to hear it.

    Try running the same test with the 3D Demo (i.e. Demo scene + Managers). You can unset the scene's OnStart cutscene to skip the intro. What then? If it then works, we'll have to dig deeper into your own game to find what's different. Start by running your own scene with the 3D Demo's Managers.

  • -I have set "Always reload the scenes when loading". (I need that for my current code to work).
    -Yes, the play one shots elements appear. As I said, they appear in the same in the position when can they can be heared before loading a game.

    -Tried the 3d demo. Put a Play One-Shot on Door:Examine. I put a long clip there (music).. when it goes back to freeroam camera I can hear it. I save the game. I load the game. That sounds still sounds because was long, so it is restored (No always reload scene when loading of course). When I click the door: examine again, another sound is generated and I can hear it.
    - So yes, in the 3d demo everything works as expected apparently

    -I went back to one of my scenes, and just tried removing temporarly the "Always reload the scenes when loading". That didn't fix the issue.

    -More information about the sounds dissapearing after load: - Is not only the sounds generated by Play On Shoot. I have some anims that play (Unscaled time - Cull Completly) sounds with it (for example birds flying across a panorama) (They're play on awake, the animator enables/disables the sound). While in play mode, if in on Scene view and zoom back to see many "scenes" at the same time, I can normally hear those sounds because the animations are playing (unculled). After I load a game, those sounds stop being heared too.
    This means, aparently, all sounds not controlled by AC (and AC Sound) are those who stop working on load.

    -So now more testing: With the 3d Demo managers back in to my scene. Those animation sounds on scene mode play (So mean it works on those settings). I made an easy Run in background cutscene to reproduce a bleeping with PlayOneShot every 3 seconds, that starts OnStart and starts OnLoad (because the Always reload scene thing).
    So yes, checked, with the 3d demo managers that sounds works after load; With my settings they don't after load (Yes on a new game).

    So then I have to go back to my settings and check what can be changed to make it work the same as the 3d demo: Some testings:

    -This are the things that I disables individually to check a fix:
    Always Reload Scene, Black out when Initializating, Load scenes asyncronisly.
    -None of this changes affected anything. Reenabled them after.

    -I changed Camera Persepctive 2d to 3d. Nothing changed. With Forced Aspect Ratio, Nothing changed.

    There is a Tonload of speech-subtitles related options that I don't have a clue if I should even touch.

    Reality is that AC has not that many options about controlling sounds that are not controlled by AC (and those work well after load too). So the Non-AC controlled sounds are those ones that stop hearing after load (I checked all my cutscenes type (Load after load, load on menus leading to save/load etc... but again, there is no "Deactivate Sound system option" anyway. But with the 3d Demo Settings work without making any change to the scene...
    The problem (or direct problem to solve it) is on Settings, Sound Settings, or Menus
    (I use simple Audio Sources in AC, no audio mixer stuff).

    But of course, you are aware of the code changes that you may have made since my previous working versions (all before 1.71.xx) so that's a clue to begin with...

    I'll probably be keeping bashing my head checking changes in the meanwhile...

  • Yes.

    I expanded the test. In that autoreplay sound loop cutscene that I made, I make it as plays both Play One Shot and Pay Sound (to play on a AC sound object).

    I also tested with the 2d demo settings. Both with 2d demo settings and 3d demo settings, both sounds work after load. With my settings only the AC sound controller object sounds.

    I also checked putting Point & Click movement method (to test stuff that work on that settings. Doesn't do anything as expected (My movement method is none)

  • And btw, didn't answer this: Yes, they sounds dissapearing from hearing on Load dissapear both on swithching scenes on loading and reloading the same scene.

  • Thanks for the details.

    It sounds like it's some unique setting in your project - but it's not possible from the above to determine what that might be. That it affects non-AC sounds is strange as well.

    If you can create a .unitypackage with a single test scene, audio clip to test with, and your game's Managers, and UI-related Asset files, PM it to me with instructions and I can take a look.

  • I fixed it some days ago, kinda Ninja Fix. (strange problem, strange solution)

    I just tried if the problem reproduced with only some managers from the demo, and others from my games. Problem was located around menus and variables, so yeah, I pinpointed it to be something in my action lists on After Load.

    I don't like the fix because I don't understand very well where the problem comes from, but I think has to do with Timescale.

    And.... I reinstalled windows and stuff, changed the project folder, using the backup where the problem was still there, and, I fix it again. So yeah... Kinda a ninja a fix that worked again.

    In my chain of cutscenes that ocurr afterload, the last one controls to reset the timscale to 1 if the player has the option to Restore timescale after some events.

    **I just played changing those Asset Actionlist attributes from pause gameplay to run in background, ** And that solved it, sound back again after load. And in both times I fixed the problems, I had a hard time to restore the settings to where the audio stopped sounding.

    It may have to do with changes on the timescale and Unity an Audio listeners... I doubt this problem will not appear again testing some combinations of timescale in the future. If I'm able to pinpoint more the problem... I'll let you know.. at least I think I know where I should look...

    Taking in consideration that AC sounds still worked.... Looked like some problem in how maybe the Timescale control actionlist comunicates with last versions of Unity maybe?

    Well... It's been a frustrating problem with a dissapointing solution.

    thanks for your attention as always.

  • edited July 2020

    Thanks for the update.

    The Time.timeScale value does indeed have an effect on audio playback. The AudioSource's ignoreListenerPause property can be used to force audio to play even when the game is paused.

    The AC Sound component's Play while game is paused? will set this automatically - but it looks like non-AC sounds would need this to be set manually through some other custom-scripted means.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.