Audio Source Is Playing#
Audio / Audio Source / Audio Source Is Playing
Description#
Compares the Is Playing property of Audio Source component to another value
Parameters#
| Name | Description |
|---|---|
| Audio Source |
Code#
// <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 Is Playing")]
[Category("Audio/Audio Source/Is Playing")]
[Description("Compares the Is Playing property of Audio Source component to another value")]
[Image(typeof(IconAudioSource), ColorTheme.Type.Yellow)]
[Keywords("Audio, Sound, Music, Ambient, Sfx")]
[Parameter("Audio Source")]
[Serializable]
public class GenConditionBool_AudioSource_CheckIsPlaying : Condition
{
[SerializeField] private GetGameObject m_AudioSource = new GetGameObject(
new GenTypeGameObject_AudioSource()
);
protected override string GetTitle(GameObject source)
{
string member = TextUtils.ThemeAsKeyword("Is Playing");
return $"{this.m_AudioSource} {member}";
}
protected override bool Run(Args args)
{
AudioSource component = this.m_AudioSource.Get<AudioSource>(args);
if (component == null) return false;
return component.isPlaying;
}
}
}