Search Results for

    Show / Hide Table of Contents

    Class ToggleAudio

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

    Inheritance
    object
    Object
    Component
    Behaviour
    MonoBehaviour
    ToggleAudio
    Namespace: GGL.Audio
    Assembly: GGL.dll
    Syntax
    [RequireComponent(typeof(Toggle))]
    public class ToggleAudio : MonoBehaviour

    Fields

    | Edit this page View Source

    clip

    Declaration
    [ShowIf("mode", ToggleAudio.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 ToggleAudio.Mode mode
    Field Value
    Type Description
    ToggleAudio.Mode

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

    | Edit this page View Source

    source

    Declaration
    [ShowIf("mode", ToggleAudio.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", ToggleAudio.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