Introduction to AUDIO in Unity
Why Stack Overflow recommends it
Stack Overflow users link it as the source of the AudioManager pattern they are building on, and as a go-to tutorial when answering Unity audio questions.
Recommended by 1 people across 1 different months, 2019 to 2021.
What it is
A beginner tutorial from Brackeys on adding sound to a Unity game. It walks through importing audio clips and their import settings, and builds a reusable AudioManager script with a Sound class so clips can be played by name from any script.
What people said
Recommends Jay · 2020-04 · Stack Overflow · on “Unity Accessing PlayOneShot from different script throws object reference error”
There is a good answer here [LINK] explaining why `new` is bad. you could you create your object in the editor and drag a reference to it on the object where it needs to be called, alternatively you can look into making an audiomanager singleton class [LINK] , or a good tutorial here [this video]
Cites Jozef Benko · 2019-08 · Stack Overflow · on “Audio Fade In/Out with C# in Unity?”
I just added an audio manager to my android platformer game in Unity and the manager is based on this video tutorial from Brackeys [this video] and it is working as expected. I would like to ask someone to help me to understand how can I implement an Audio Fade In/Out code (I think it will be a coroutine) so when the game starts all sounds fade in and when I call a function on a button (an Exit game UI button is already created) than all sounds fade out. I tried to implement a coroutine from my previous UI Manager script but unfortunately somehow I'm having problems to understand the problem. Every other functionalities of the game are working as I wanted. Music Class.cs using UnityEngine.Audio;
Cites Yoekek · 2020-12 · Stack Overflow · on “Changing volume of one AudioSource in an array with a slider in Unity”
I am trying to control the volume of the first audiosource in an array with a slider. The problem is that it's telling me there is no definition for 'volume' in audiosources[0].volume. The script is in an AudioManager from a tutorial from Brackeys: Tutorial [this video] . //Volumeslider public void VolumeSlider(float newVolume) { Component[] audiosources; audiosources = GetComponents(typeof(AudioSource)); audiosources[0].volume = newVolume; The error: 'Component' does not contain a definition for 'volume' and no accessible extension method 'volume' accepting a first argument of type 'Component' could be found (are you missing a using directive or an assembly reference?) [Assembly-CSharp]csharp(CS
Cites Barto · 2021-06 · Stack Overflow · on “How do I change the pitch of audio when slowing down time?”
I've been making a game using Unity and I added a slow motion function. Afterwards, when I added audio, I wanted to change the pitch of all audio whenever the slow motion function ocurred, but I can't seem to do it. I've been using Brackey's audio tutorial ( here if you wanna see it [this video] ) to guide me into using audio in Unity Here is my audio manager: using UnityEngine.Audio; using System; public class soundManager : MonoBehaviour { public Sound[] sounds; void Awake() { foreach(Sound s in sounds) { s.source = gameObject.AddComponent<AudioSource>(); s.source.clip = s.clip; s.source.volume = s.volume; s.source.pitch = s.pitch; } } public void Play(string name) { Sound s = Array.Find(sounds