Audio emitters

emit audio used to create spatialized audio. You can add them to any entity.

The pitch and volume of the sound changes as the moves closer to and away from the audio emitter.

Note

You need at least one AudioListenerComponent in the scene to hear audio from audio emitters.

  • In the Scene view, select an entity you want to be an audio emitter.

Add AudioEmitter Component

Now we need to add audio to the emitter.

  • Under Audio Emitter, click (Add) and specify a name for the audio.
  • From the Asset View, drag and drop an audio asset to the audio you just added:

Drag and drop an audio asset

Alternatively, click (Select an asset).

Pick up an asset

Then choose an audio asset:

  • Repeat steps 3 and 4 to add as many audio assets as you need.

Audio emitter properties

Now we need to create a script to play and configure the audio asset.

  • In your script, instantiate for each sound you want to use in the script.

For example, say we have two sounds, MySound1 and MySound2:

Property / methodDescription
Loops audio. Has no effect if PlayAndForget() is set to true.
Gets or sets sound pitch (frequency). Use with caution for spatialized audio.
PlayStateGets the current state of the audio emitter sound controller.
Volume of the audio.
Pause()Pauses audio.
Plays audio.
PlayAndForget()Plays audio once, then clears the memory. Useful for short sounds such as gunshots. Overrides .
Stop()Stops audio.

For example:

This sound will loop at double the original pitch and half the original volume. For more information, see the .

Game Studio lists the script as a component under Add component. Add the script to the audio emitter entity.

  • In the Scene view, select an entity you want to be an audio emitter.
  • Click Add component and select the script.