Set Audio Source Play On Awake#
Audio / Audio Source / Set Audio Source Play On Awake
Description#
Sets the Play On Awake property of Audio Source component
Parameters#
| Name | Description |
|---|---|
| Audio Source | |
| Value |
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("Set Audio Source Play On Awake")]
[Category("Audio/Audio Source/Play On Awake")]
[Description("Sets the Play On Awake property of Audio Source component")]
[Image(typeof(IconAudioSource), ColorTheme.Type.Yellow)]
[Keywords("Audio, Sound, Music, Ambient, Sfx")]
[Parameter("Audio Source")]
[Parameter("Value")]
[Serializable]
public class GenInstructionBool_AudioSource_SetPlayOnAwake : Instruction
{
[SerializeField] private GetGameObject m_AudioSource = new GetGameObject(
new GenTypeGameObject_AudioSource()
);
[SerializeField] private GetBool m_Value = new GetBool();
protected override string GetTitle(GameObject source)
{
string member = TextUtils.ThemeAsKeyword("Play On Awake");
return $"{this.m_AudioSource} {member} = {this.m_Value}";
}
protected override Awaitable Run(Args args)
{
AudioSource component = this.m_AudioSource.Get<AudioSource>(args);
if (component == null) return Done;
component.playOnAwake = (bool) this.m_Value.Get(args);
return Done;
}
}
}