Unity Development Tips for eight audio usage tips

Source: Internet
Author: User

1. Audiosource pitch Speed Play default = 1 battle there are twice times the speed of 3 times times the corresponding skill sound also has the need of simultaneous double play.

2. Scene switch background music has gradient requirements, with the help of Dotween plug-ins, it is important to note that Dofade () requires volume=0

Audiosource.volume = 0
Audiosource:dofade (self.musicvolume,2.5)

3. Background music is relatively large, each file is named a assetbundle is the wise choice, in the scene switch when the previous background music unloading

4.Load Type

Decompress on Load
Once the audio file is loaded, it will be decompressed. Use this option for smaller compressed sounds to avoid the performance overhead of immediate decompression. Note that extracting Vorbis encoded sound at load is about 10 times times more memory than using it (approximately 3.5 times times for ADPCM encoding), so do not use this option for large files. Applies to sound files
Compressed in Memory
Save memory by keeping sound compressed in memory and uncompressed while playing. This option has a small performance overhead (especially for ogg/vorbis compressed files), so it can only be used for larger files, such as background music.
Streaming
Dynamically decode sounds. This method uses a minimum amount of memory to buffer the compressed data that is gradually read from the disk and decoded in the run.
Note: Even if no audio data is loaded, the streaming fragment will have an overload of about 200KB. So it is more suitable for larger files, such as background music.

Unity Development Tips for eight audio usage tips

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.