Vector2#
Can Read
Cannot Write
Description#
A constant Vector2 value
Code#
using System;
using System.Globalization;
using UnityEngine;
using VisualScript.Icons;
namespace VisualScript.Runtime
{
[Get]
[Inline(nameof(m_Value))]
[Title("Vector2")]
[Category("Vector2")]
[Description("A constant Vector2 value")]
[Image(typeof(IconVector2), ColorTheme.Type.Lime)]
[Keywords("Value", "Constant")]
[Serializable]
public class TypeVector2Constant : TypeVector2
{
[SerializeField] private Vector2 m_Value;
public override Vector2 GetPreview(GameObject source) => this.m_Value;
public TypeVector2Constant() : this(default)
{ }
public TypeVector2Constant(Vector2 value)
{
this.m_Value = value;
}
public override Vector2 Get(Args args)
{
return this.m_Value;
}
public override string ToString()
{
return this.m_Value.ToString("0.##", CultureInfo.InvariantCulture);
}
protected override SubscriptionMode Subscription => SubscriptionMode.OnEditorChange;
}
}