Set Audio Source Priority#
Audio / Audio Source / Set Audio Source Priority
Description#
Sets the Priority 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 Priority")]
[Category("Audio/Audio Source/Priority")]
[Description("Sets the Priority 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 GenInstructionInteger_AudioSource_SetPriority : Instruction
{
[SerializeField] private GetGameObject m_AudioSource = new GetGameObject(
new GenTypeGameObject_AudioSource()
);
[SerializeField] private GetInteger m_Value = new GetInteger();
protected override string GetTitle(GameObject source)
{
string member = TextUtils.ThemeAsKeyword("Priority");
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.priority = (int) this.m_Value.Get(args);
return Done;
}
}
}