Closed stilnat closed 11 months ago
Please remember to add gitbook documentation on this.
Also, Im tasking you with turning the known issues into github issues (including the lobby ambience sound one) since you know a bit more about the issues than me.
Summary
credits to @EikoBiko #899 for the original PR. This PR intends to put the audio manager back into SS3D.
PR checklist
Pictures/Videos)
Messing around with everything with sound in the PR :
https://github.com/RE-SS3D/SS3D/assets/14344825/fabf51ac-04f9-45b5-86b6-b2381fcbaaf1
Messing around with ambient sounds :
https://github.com/RE-SS3D/SS3D/assets/14344825/8d96df95-1d66-4467-bf2c-1c5019bd72e1
Testing
Test the sound syncing by muting host, performing action with host and checking that client get the sound.
Networking checklist
Changes
The audioManager (audioSystem now) is now supporting music as well. in the previous PR, it only supported SFX. For it to support music, I just added a new List of available audio sources, set up to use the main mixer (instead of the SFX one). I add to restructure the code a lot to make it clean. Also now you have to precise through an enum value when you call play sound, if that should play as music or sfx. Not much of a hassle imo.
Audio is now synced between clients, on the old code version, I'm confident that code was only local, I tried by building outdated and putting one instance of the game mute and trying to trigger sounds from it for the other client. It does not work.
Known issues
"The human prefab is no longer the parent of the listener component. Instead, the Player Camera is the parent, and it positions the listener relative to its target." Something I did not touch in this PR, I'm not sure how to deal with this, but it's probably good to do so. Need help.
the networking part assumes there's not more than 1 audio source per network object. It uses network object to find a given network audio source. Not easy to fix, maybe better to work around it since we can play multiple clips on a single audio source https://docs.unity3d.com/ScriptReference/AudioSource.PlayOneShot.html