Vector3#
Can Read
Cannot Write
Description#
A constant Vector3 value
Code#
using System;
using System.Globalization;
using UnityEngine;
using VisualScript.Icons;
namespace VisualScript.Runtime
{
[Get]
[Inline(nameof(m_Value))]
[Title("Vector3")]
[Category("Vector3")]
[Description("A constant Vector3 value")]
[Image(typeof(IconVector3), ColorTheme.Type.Lime)]
[Keywords("Value", "Constant")]
[Serializable]
public class TypeVector3Constant : TypeVector3
{
[SerializeField] private Vector3 m_Value;
public override Vector3 GetPreview(GameObject source) => this.m_Value;
public TypeVector3Constant() : this(default)
{ }
public TypeVector3Constant(Vector3 value)
{
this.m_Value = value;
}
public override Vector3 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;
}
}