Documentation index for AI agents (llms.txt) A Markdown version of every page is available: request the page's source under /docs/, follow the "alternate" link in this page's head, or start from /llms.txt.
Visual Script logo Manual

Play Music#

Audio / Play Music

Description#

Plays an Audio resource on the Music 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 Music")]
    [Image(typeof(IconHeadset), ColorTheme.Type.Yellow)]

    [Description("Plays an Audio resource on the Music channel")]
    [Category("Audio/Play Music")]

    [Serializable]
    public class InstructionAudioUnityPlayMusic : InstructionAudioUnityPlayBase
    {
        [SerializeField] private AudioFieldMusic m_Configuration = new AudioFieldMusic();

        protected sealed override AudioChannel Channel => AudioChannel.Music;

        protected sealed override AudioConfig GetAudioConfig(Args args)
        {
            return this.m_Configuration.Get(args);
        }
    }
}
Visual Script logoVisual Script © Catsoft Works 2026. All rights reserved.