Study Notes for beginners, please correct me if you have any mistakes. The number is also please point out, thank you.
3D Audio System space position is important
1 Create a new scene click on the navigation menu bar "Gameobject" "3D Object" "Capsule" creates a capsule body and rotates it sideways
2 Add the Audio Souce component to it, uncheck play on awake set spatial blend to 1 for which you are adding a script
usingUnityengine;usingSystem.Collections; Public classC_11_6:monobehaviour {PrivateAudiosource Audiosource; voidAwake () {Audiosource= getcomponent<audiosource>(); } voidUpdate () {//The bird keeps barking . if(!audiosource.isplaying) Play (); //birds fly to the rightTransform.position + = vector3.right * 1f *Time.deltatime; } voidPlay () {//play a bird's cryAudiosource.playdelayed (Random.range (0.5f,1.6f)); }}
Music audio--06 Instances -3d music Sound