resultsgasil.blogg.se

Unity play sound
Unity play sound










unity play sound

If enabled, the sound will play back in 3D space. Best for medium length sound effects and music. Smaller file size, lower/variable quality. The specific format that will be used for the sound at runtime. In most cases you will work with Audio Sources more than Clips or Listeners. There can be only one Audio Listener in your scene, and this is usually attached to the Main Camera. While a Source is playing, an Audio Listener can "hear" all Sources that are close enough, and those are the sounds you will hear through your speakers. When you attach your Clip to an object in the game, it becomes an Audio Source and it now has Volume, Pitch, and a wealth of other properties.

unity play sound

Audio Clips work in conjunction with Audio Sources and an Audio Listener.

unity play sound

The audio data will be larger, but sounds won't need to be decoded at play time.Īny Audio File imported into Unity is an Audio Clip.

  • Native: Use Native (WAV, AIFF) audio for short sound effects.
  • Same goes for importing MP3, when only targeting mobile platforms. But converting to mobile platforms will force a re-encode to MP3 and cause a slight quality degradation. If only targeting Mac/PC (standalones, webplayers) importing an Ogg Vorbis file will not degrade the quality. For the best sound quality supply the audio in an uncompressed format such as WAV or AIFF (containing PCM data) and let Unity do the encoding. Depending on the target, Unity will encode the audio to either Ogg Vorbis(Mac/PC/Consoles) or MP3 (Mobile platforms). The audio data will be small, but will cost CPU cycles to decode at play time.
  • Compressed: Compress sounds by choosing the compressed option from inside the Editor.











  • Unity play sound