Play Sound Effect#
Audio / Play Sound Effect
Description#
Plays an Audio resource on the Sound Effect channel
Parameters#
| Name | Description |
|---|---|
| Configuration | Whether to use the default settings of the channel, an Audio Preset or custom ones |
| Preset | The Audio Preset asset that contains the shared configuration |
| Loop | If the audio plays just once for loops forever |
| Transition | The fade in effect in seconds |
| Time Scale | Whether this audio is affected by the time scale or not |
| Priority | The priority of this audio versus the other sounds |
| Volume | The volume for this audio |
| Pitch | The pitch value for this audio |
| Stereo Pan | The mix of the left and right channels |
| Spatial Blend | The mix between 2D and 3D audio |
| Reverb Zone Mix | How much the audio is affected by the reverb zone |
| Volume Rolloff | How the audio volume is affected by distance |
| Min Distance | The minimum distance for the audio to be heard |
| Max Distance | The maximum distance for the audio to be heard |
| Doppler Level | The amount of doppler effect for the audio |
| Spread | The spread of this 3D audio in speaker space |
| Target | Whether the audio is associated with a particular Game Object or not |
| Location | The point in space where this audio is played |
| Save ID | Optionally stores the ID of the audio played |
Code#
using System;
using UnityEngine;
using VisualScript.Icons;
namespace VisualScript.Runtime
{
[Title("Play Sound Effect")]
[Image(typeof(IconMusicNote), ColorTheme.Type.Yellow)]
[Description("Plays an Audio resource on the Sound Effect channel")]
[Category("Audio/Play Sound Effect")]
[Serializable]
public class InstructionAudioUnityPlaySoundEffect : InstructionAudioUnityPlayBase
{
[SerializeField] private AudioFieldSoundEffect m_Settings = new AudioFieldSoundEffect();
protected sealed override AudioChannel Channel => AudioChannel.SoundEffect;
protected sealed override AudioConfig GetAudioConfig(Args args)
{
return this.m_Settings.Get(args);
}
}
}