Set Scriptable Object#
Set / Set Scriptable Object
Description#
Sets a Scriptable Object value
Parameters#
| Name | Description |
|---|---|
| Set | Where the value is stored |
| Value | The value to store |
Code#
using System;
using UnityEngine;
using VisualScript.Icons;
namespace VisualScript.Runtime
{
[Title("Set Scriptable Object")]
[Image(typeof(IconCubeOutline), ColorTheme.Type.Blue, typeof(BadgeScriptableObject))]
[Description("Sets a Scriptable Object value")]
[Category("Set/Set Scriptable Object")]
[Parameter("Set", "Where the value is stored")]
[Parameter("Value", "The value to store")]
[Keywords("Set", "Change", "Modify", "Assign")]
[Serializable]
public class InstructionCoreSetScriptableObject : Instruction
{
[SerializeField] private SetScriptableObject m_Set = new SetScriptableObject();
[SerializeField] private GetScriptableObject m_Value = new GetScriptableObject();
protected override string GetTitle(GameObject source) => $"{this.m_Set} = {this.m_Value}";
protected override Awaitable Run(Args args)
{
ScriptableObject value = this.m_Value.Get(args);
this.m_Set.Set(value, args);
return Done;
}
}
}