AudioClip audio clip

* AudioClip
* audio clip ( Audio clip ).
* We import to Unity All sound files in , stay Unity The resource types in the engine are all  AudioClip type .
* Unity Available audio formats : .aif   .wav   .mp3   .ogg
* stay Project Panel's Assets Create a “Audios” Folder to store and manage audio resources used in the game .
AudioSource assembly

* Introduction to components
* AudioSource: Audio source components , For playing audio clips (AudioClip) resources .
* establish  AudioSource
* Create a new empty object ;
* Add to the empty object  AudioSource assembly .Component --> Audio --> AudioSource
* AudioSource Common properties
* AudioClip( audio clip )
* Specify which audio file this audio source plays .
* Play On Awake( Start playback on wake up )
* After checking , After the game runs , It will start playing .
* Loop( loop )
* After checking , Voice in “ Single tune circulation ” state .
* Mute( Mute )
* After checking , Mute , But the audio is still playing .
* Volume( volume )
* 0: No sound ;1: Volume Max .
* Spatial Blend( Spatial mixing )
* Set sound to be 2D voice , still 3D voice .
* 2D There is no spatial change in sound ,3D There is a spatial change in sound , The closer to the source, the more obvious .
* Audio Listener assembly
* Audio Listener: Sound listener , In the game world “ Ears ”.
* We rely on this component to listen to the sound in the game , Without this component , We can't hear anything .
* By default, this component is attached to the camera .
* Audio Source Common functions
* Play() function
* Play audio clip .
* Stop() function
* stop playing .
* Pause() function
* Pause playback . public class AudioController : MonoBehaviour { private AudioSource
m_AudioSource; void Start () { m_AudioSource =
gameObject.GetComponent<AudioSource>(); } void Update () {
if(Input.GetKeyDown(KeyCode.A)) { m_AudioSource.Play (); } if
(Input.GetKeyDown(KeyCode.S)) { m_AudioSource.Stop (); } if
(Input.GetKeyDown(KeyCode.D)) { m_AudioSource.Pause (); } } }
 

 

 

Technology
©2019-2020 Toolsou All rights reserved,
It's unexpected Python Cherry tree (turtle The gorgeous style of Library )Unity3D of UGUI Basics -- Three modes of canvas os Simple use of module computer network --- Basic concepts of computer network ( agreement , system )html Writing about cherry trees , Writing about cherry trees Some East 14 Pay change 16 salary , Sincerity or routine ?Unity-Demo Examples ✨ realization UI- Backpack equipment drag function 06【 Interpretation according to the frame 】 Data range filtering -- awesome java Four functional interfaces ( a key , simple )