Audio Scripting
Headers: Core/include/Core/AudioEngine.h, Core/include/Core/AudioComponents.h
AudioSource Component
Attach to any entity to make it a sound emitter:
AudioListener Component
A tag component that marks which entity "hears" 3D audio. Typically attached to the main camera:
Tip
Attach AudioListener to your main camera entity so 3D sounds are heard from the player's perspective.
Playing Sounds from Behaviors
Use the AudioEngine directly for one-shot sounds:
AudioEngine API
3D Spatial Audio
For sound that changes based on distance and direction:
- Add
AudioSourceto the sound-emitting entity withspatial = true - Add
AudioListenerto the camera or player entity - The engine automatically updates listener position from the entity's Transform