Search Results for

    Show / Hide Table of Contents

    Class ButtonAudio

    Behaviour that associates a sound to a button. Just by adding this component, everything is set up.

    Inheritance
    object
    Object
    Component
    Behaviour
    MonoBehaviour
    ButtonAudio
    Namespace: GGL.Audio
    Assembly: GGL.dll
    Syntax
    [RequireComponent(typeof(Button))]
    [AddComponentMenu("GG-Library/UI/Audio/Button Audio")]
    [HelpURL("https://ggl.yoannhaffner.com/articles/audio.html#configuration")]
    public class ButtonAudio : MonoBehaviour

    Fields

    | Edit this page View Source

    clip

    Declaration
    [ShowIf("mode", ButtonAudio.Mode.DEFAULT)]
    [SerializeField]
    protected AudioClip clip
    Field Value
    Type Description
    AudioClip

    In DEFAULT mode, audio file to play.

    | Edit this page View Source

    mode

    Declaration
    [SerializeField]
    protected ButtonAudio.Mode mode
    Field Value
    Type Description
    ButtonAudio.Mode

    Define how the script will behaviour to play an audio file.

    | Edit this page View Source

    source

    Declaration
    [ShowIf("mode", ButtonAudio.Mode.CUSTOM)]
    [SerializeField]
    protected AudioSource source
    Field Value
    Type Description
    AudioSource

    In CUSTOM mode, AudioSource to play.

    | Edit this page View Source

    volume

    Declaration
    [ShowIf("mode", ButtonAudio.Mode.DEFAULT)]
    [SerializeField]
    protected float volume
    Field Value
    Type Description
    float

    In DEFAULT mode, volume to play the audio file.

    Methods

    | Edit this page View Source

    PlaySound()

    Play a sound depending on the mode. Defaultly called by the associated button once clicked.

    Declaration
    public virtual void PlaySound()
    • Edit this page
    • View Source
    In this article
    Back to top Generated by DocFX