Scriptable Object#
Can Read
Cannot Write
Description#
A constant Scriptable Object value
Code#
using System;
using UnityEngine;
using VisualScript.Icons;
namespace VisualScript.Runtime
{
[Get]
[Inline(nameof(m_Value), typeof(ScriptableObject), false)]
[Title("Scriptable Object")]
[Category("Scriptable Object")]
[Description("A constant Scriptable Object value")]
[Image(typeof(IconCubeOutline), ColorTheme.Type.Blue, typeof(BadgeScriptableObject))]
[Keywords("Value", "Constant")]
[Serializable]
public class TypeScriptableObjectConstant : TypeScriptableObject
{
[SerializeField] private ScriptableObject m_Value;
public override ScriptableObject GetPreview(GameObject source) => this.m_Value;
public TypeScriptableObjectConstant() : this(null)
{ }
public TypeScriptableObjectConstant(ScriptableObject value)
{
this.m_Value = value;
}
public override ScriptableObject Get(Args args)
{
return this.m_Value;
}
public override string ToString()
{
return TextUtils.Name(this.m_Value);
}
protected override SubscriptionMode Subscription => SubscriptionMode.OnEditorChange;
}
}