dacha
    Preparing search index...

    Class AudioSource

    Plays a sound for an actor. Call play and stop, or turn on autoplay.

    Audio

    Hierarchy (View Summary)

    Index
    actor?: Actor

    The actor that has this component. It is undefined until the component is added to an actor.

    autoplay: boolean

    Whether the audio plays automatically when the scene is entered or when the actor is added to the scene

    group: string

    Group of the audio, used to combine audio sources together and control them at once

    looped: boolean

    Whether the audio is looped

    src: string

    Path to the audio asset

    volume: number

    Volume of the audio, from 0 to 1

    • Returns the component of the same class on the parent actor.

      Returns Component<object> | undefined

      The component, or undefined if the actor has no parent actor or the parent has no such component.

    • Starts playback.

      If the sound is already playing, it restarts from the beginning by default; pass restart: false to leave an already-playing instance untouched instead.

      Parameters

      • restart: boolean = true

        Whether to restart the sound if it's already playing. Defaults to true.

      Returns void

    • Stops playback.

      Returns void