{"id":25044640,"url":"https://github.com/ashaydave/audiomanagerunity","last_synced_at":"2026-04-24T16:39:26.823Z","repository":{"id":217005433,"uuid":"742911148","full_name":"ashaydave/AudioManagerUnity","owner":"ashaydave","description":"My Audio Manager singleton that I've been using as a basis for projects in XR in Unity.","archived":false,"fork":false,"pushed_at":"2024-07-25T21:59:22.000Z","size":47,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-06T05:18:51.154Z","etag":null,"topics":["audio","audiomanager","audiomanager-script","audioprogramming","game-development","gameaudio","unity","unity-audio","unity-audio-utils","unity-scripts","unity2d","unity3d","unityaudio"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ashaydave.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-13T18:28:40.000Z","updated_at":"2025-01-24T22:28:15.000Z","dependencies_parsed_at":"2024-01-14T04:49:57.873Z","dependency_job_id":"b2713580-28c1-4b6c-ac04-d295ff06e8cc","html_url":"https://github.com/ashaydave/AudioManagerUnity","commit_stats":null,"previous_names":["ashaydave/audiomanagerunity"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashaydave%2FAudioManagerUnity","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashaydave%2FAudioManagerUnity/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashaydave%2FAudioManagerUnity/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashaydave%2FAudioManagerUnity/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ashaydave","download_url":"https://codeload.github.com/ashaydave/AudioManagerUnity/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246395572,"owners_count":20770240,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["audio","audiomanager","audiomanager-script","audioprogramming","game-development","gameaudio","unity","unity-audio","unity-audio-utils","unity-scripts","unity2d","unity3d","unityaudio"],"created_at":"2025-02-06T05:18:52.884Z","updated_at":"2026-04-24T16:39:25.444Z","avatar_url":"https://github.com/ashaydave.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Unity AudioManager Singleton\n\nI've been using this singleton for a couple of XR projects based in Unity, figured I should keep updating it here. I referenced a few existing audio manager scripts out there, particularly this logic from [CodeMonkey](https://www.youtube.com/watch?v=QL29aTa7J5Q).\n\n## How to Use\n\n1. **Setup:**\n   - Create an empty AudioManager GameObject and attach the script to it.\n   - Define sound clips in the `SoundClips` enum list.\n   - Create an Audio Mixer according to your sounds and the way you like to setup your mix.\n   - In the inspector, populate the `audioClipArray` with `AudioClipToPlay` instances, associating each sound clip with its corresponding audio clip and audio mixer group.\n\n2. **Play Sounds:**\n   - Call `PlaySound3D` or `PlaySound2D` in a script attached to a GameObject to play 3D or 2D sounds, respectively.\n   - Provide the appropriate parameters such as sound clip type, pitch, volume, spatial blend, spread, and loop flag.\n\n3. **Stop Sounds:**\n   - Call `StopSound` to stop a currently playing sound based on the specified sound clip.\n\n4. **Fade In/Out:**\n   - Use the `FadeInSound` and `FadeOutSound` methods for implementing sound fading.\n\n## Example Usage\n\n```csharp\n// Play a 3D sound at the object's position with default settings\n// Note - \"ButtonClick\" will be a sound from the SoundClips enum\nAudioManager.PlaySound3D(AudioManager.SoundClips.ButtonClick, playerTransform, 1f, 1f, 0f, false, true, 1f);\n\n// Play a 2D looping sound with custom pitch and volume\nAudioManager.PlaySound2D(AudioManager.SoundClips.RoomAmbience, 0.8f, 0.5f, true, false, 0f);\n\n// Stop the RoomAmbience sound\nAudioManager.StopSound(AudioManager.SoundClips.RoomAmbience);\n\n// Fade Out sound\nStartCoroutine(FadeOutSound(AudioManager.SoundClips.RoomAmbience, 3f));\n\n```\n![Capture 4](https://github.com/ashaydave/AudioManagerUnity/assets/112194962/d94a5f81-b64e-41a8-baa9-7818706df228)\n\n## Future\nI know this can be optimized even further, probably by using object pooling instead of creating a new GameObject for each sound, if you have a lot of sounds playing frequently. I'll try adding this in the future either as a separate script or integrated into the Audio Manager.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fashaydave%2Faudiomanagerunity","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fashaydave%2Faudiomanagerunity","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fashaydave%2Faudiomanagerunity/lists"}