ecspresso
    Preparing search index...

    Function createAudioSource

    • Create an audioSource component for entity-attached audio.

      Type Parameters

      • Ch extends string

      Parameters

      • sound: string

        Asset key for the sound

      • channel: Ch

        Channel to play on

      • Optionaloptions: { autoRemove?: boolean; loop?: boolean; volume?: number }

        Optional configuration

      Returns Pick<AudioComponentTypes<Ch>, "audioSource">

      Component object suitable for spreading into spawn()

      ecs.spawn({
      ...createAudioSource('explosion', 'sfx'),
      ...createTransform(100, 200),
      });