---
tags:
    - "Audio, Sound, Music, Ambient, Sfx"
---

# Audio Source Play One Shot

[Audio](../index.md) / [Audio Source](index.md) / **Audio Source Play One Shot** Clip, VolumeScale

## Description

Executes the Play One Shot method on the Audio Source component

## Parameters

| Name | Description |
| :--- | :---------- |
| Clip |  |
| Volume Scale |  |

## Code

```cs
// <auto-generated>
// This script was automatically generated using the Visual Script Transpiler.
// Do not modify. Changes to this file will be lost when updating the package.
// </auto-generated>

using System;
using UnityEngine;
using VisualScript.Icons;
using UnityEngine.Audio;

namespace VisualScript.Runtime
{
    [Title("Audio Source Play One Shot")]
    [Category("Audio/Audio Source/Play One Shot", "Clip, VolumeScale")]
    [Description("Executes the Play One Shot method on the Audio Source component")]
    
    [Image(typeof(IconAudioSource), ColorTheme.Type.Yellow)]
    [Keywords("Audio, Sound, Music, Ambient, Sfx")]
    
    [Parameter("Clip")]
    [Parameter("Volume Scale")]
    
    [Serializable]
    public class GenInstructionAudioSource_PlayOneShot_2_AudioClipClip_FloatVolumeScale : Instruction
    {
        [SerializeField] private GetGameObject m_AudioSource = new GetGameObject(
            new GenTypeGameObject_AudioSource()
        );
        
        [SerializeField] private GetAudioResource m_Clip = new GetAudioResource();
        
        [SerializeField] private GetNumber m_VolumeScale = new GetNumber();
        
        protected override string GetTitle(GameObject source)
        {
            string method = TextUtils.ThemeAsKeyword("Play One Shot");
            return $"{this.m_AudioSource} {method} ({this.m_Clip}, {this.m_VolumeScale})";
        }
        
        protected override Awaitable Run(Args args)
        {
            AudioSource component = this.m_AudioSource.Get<AudioSource>(args);
            if (component == null) return Done;
            
            component.PlayOneShot(
                (AudioClip) this.m_Clip.Get(args),
                (float) this.m_VolumeScale.Get(args)
            );
            
            return Done;
        }
    }
}


```

