Class ToggleAudio
Behaviour that associates a sound to a toggle. Just by adding this component, everything is set up.
Namespace: GGL.Audio
Assembly: GGL.dll
Syntax
[RequireComponent(typeof(Toggle))]
public class ToggleAudio : MonoBehaviour
Fields
| Edit this page View Sourceclip
Declaration
[ShowIf("mode", ToggleAudio.Mode.DEFAULT)]
[SerializeField]
protected AudioClip clip
Field Value
Type | Description |
---|---|
AudioClip | In DEFAULT mode, audio file to play. |
mode
Declaration
[SerializeField]
protected ToggleAudio.Mode mode
Field Value
Type | Description |
---|---|
ToggleAudio.Mode | Define how the script will behaviour to play an audio file. |
source
Declaration
[ShowIf("mode", ToggleAudio.Mode.CUSTOM)]
[SerializeField]
protected AudioSource source
Field Value
Type | Description |
---|---|
AudioSource | In CUSTOM mode, AudioSource to play. |
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 SourcePlaySound()
Play a sound depending on the mode. Defaultly called by the associated button once clicked.
Declaration
public virtual void PlaySound()