-
Notifications
You must be signed in to change notification settings - Fork 545
AudioManager
高凯 edited this page Dec 31, 2017
·
2 revisions
Use AudioManager, a line of code to play the game sound
- Make sure the music is in the Resources directory and generate the package settings correctly
AudioManager
static AudioSource PlayMusic2D (string musicName, bool isLoop)
Play a 2D music
static AudioSource PlaySound2D (string soundName, float pitch, bool isLoop = false)
Play a 2D sound effect
static void PlaySound2D (string soundName, float delay)
Play a 2D sound effect with variable pitch
static AudioSource PlaySound3D (string soundName, GameObject gameObject)
Play a 3D sound, passing in an object to play the sound
s_GlobalVolume
global volume, ranging from 0 to 1, multiplied by sound volume and music volume
s_MusicVolume
music volume, ranging from 0 to 1
s_SoundVolume
sound volume, ranging from 0 to 1
AudioManager.PlayMusic2D ("funnyLaugh", false);