Music audio--06 Instances -3d music Sound

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.