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

# Audio Source Play On Gamepad

[Audio](../index.md) / [Audio Source](index.md) / **Audio Source Play On Gamepad**

## Description

Compares the Play On Gamepad method of Audio Source component to another value

## Parameters

| Name | Description |
| :--- | :---------- |
| Audio Source |  |
| Slot |  |

## 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 On Gamepad")]
    [Category("Audio/Audio Source/Play On Gamepad")]
    [Description("Compares the Play On Gamepad method of Audio Source component to another value")]
    
    [Image(typeof(IconAudioSource), ColorTheme.Type.Yellow)]
    [Keywords("Audio, Sound, Music, Ambient, Sfx")]
    
    [Parameter("Audio Source")]
    [Parameter("Slot")]
    
    [Serializable]
    public class GenConditionBool_AudioSource_CheckPlayOnGamepad_1 : Condition
    {
        [SerializeField] private GetGameObject m_AudioSource = new GetGameObject(
            new GenTypeGameObject_AudioSource()
        );
        
        [SerializeField] private GetInteger m_Slot = new GetInteger();
        
        protected override string GetTitle(GameObject source)
        {
            string method = TextUtils.ThemeAsKeyword("Play On Gamepad");
            string parameters = $"({this.m_Slot})";
            return $"{this.m_AudioSource} {method}";
        }
        
        protected override bool Run(Args args)
        {
            AudioSource component = this.m_AudioSource.Get<AudioSource>(args);
            if (component == null) return false;
            
            bool value = component.PlayOnGamepad(
                (int) this.m_Slot.Get(args)
            );
            
            return value;
        }
    }
}


```

