Skip to main content

SoundPlayer

What is a SoundPlayer for?​

  • It is responsible for executing a sound, whether "2D" or "3D" in the scene.

⚠️ for the sound to be heard, there must be a SoundListener in the scene, which is usually placed in the Camera ⚠️

Sound file​

  • The sound file to play.


Load mode​

⚠️ see more about sound loading modes at types of sound execution ⚠️

Immediate​

  • Freezes the game until the sound is fully loaded (larger sounds tend to have a longer loading time).

Asynchronous​

  • Loads sound while the game is running.

Stream​

  • Starts playing sound immediately, even while charging.


Play on start​

  • Defines whether or not sound will start when the scene loads.


Diameter​

  • The diameter of the sound.


Loop​

  • Defines whether the sound will repeat or not in a loop.


Speed​

  • The speed of sound reproduction.


Volume​

  • The volume of the sound.


Pitch​

  • The pitch of the sound.


Mode​

  • The way of representing the sound.

2D​

  • Runs regardless of the scene. The sound will have the same volume regardless of the distance from the SoundPlayer to the SoundListener.

3D​

  • Execute in the scene. The sound will have its volume changed according to the distance from the SoundPlayer to the SoundListener (the closer, the higher the volume, the further away, the lower the volume).

  • The SoundPlayer needs to be within range of the SoundListener and the SoundListener needs to be within range of the SoundPlayer for sound to be detected and heard.

Distance curve​
  • The distance curve changes the behavior of the sound according to the values ​​on the graph.


Stop​

  • Stop playing sound.


Play​

  • Play the sound.