Skip to content

Project setup

stechyo edited this page Jan 13, 2024 · 4 revisions

Check the demo project on each release for a decent integration example. Your scene should have:

  • A SteamAudioConfig node. Nothing will happen if this node isn't in the scene, and having it allows you to configure some overall settings.
  • For each static mesh that you want to enable for sound occlusion and reflection, you'll want to add a SteamAudioGeometry node. You can either add it to a MeshInstance3D or a CollisionShape3D that has a sphere, cylinder, box, capsule or concave polygon shape. You don't gain anything by adding it to both nodes on the same mesh, so you ideally want to add it to the CollisionShape3D node (that node, hopefully, has a lot less polygons than your mesh, unless it's a very low-poly mesh - if it doesn't, consider changing that, as you're probably burning performance pointlessly whether you're using this extension or not). You can configure the material on this node to allow for more or less sound to pass through it, or to tweak how much sound it reflects (see SteamAudioMaterial). The extension comes with the material presets that feature in Valve's official SteamAudio plugin for Unity.
  • You need one SteamAudioListener node in the place where you'll want to simulate a listener. This is probably your camera, so put it as a child of your Camera3D node. Multiple listeners are not supported, and neither are zero.
  • For each audio source that you'd like to apply sound effects to, you must use a SteamAudioPlayer node instead of e.g. an AudioStreamPlayer3D. In this node you can configure different settings and toggle SteamAudio effects. Do not use the stream property of this node unless 0.1.0 has been released, opt for sub stream instead. If you want to change the player's stream at runtime, see SteamAudioStreamPlayback. Note that, if you don't need the spatial audio effects offered by this extension in a particular audio source, you are probably better off using an AudioStreamPlayer3D.