AudioSource.priority

Switch to Manual
public int priority;

Description

Sets the priority of the AudioSource.

Unity virtualizes AudioSources when the number of active AudioSources exceeds the limit set by your project's maximum real voices. Real voices are audio sources that are audible in the scene.

Virtualization is when Unity makes the AudioSource inaudible, but still keeps track of the audio's playback position and state so it's ready to be a real voice when their priority or volume overtakes another sound. Unity virtualizes AudioSources with the lowest priority first, followed by volume if two sounds have the same priority. Priority is an integer between 0 (high priority) and 255 (low priority).

To change the value of the maximum number of real or virtual voices:

  1. In the menu go to Edit > Project Settings > Audio.
  2. Set Maximum Real Voices and Maximum Virtual Voices to your preferred values

WebGL: This setting doesn't affect WebGL because there is no limit on the number of audio channels in the WebGL platform.


Did you find this page useful? Please give it a rating: