Vector2 X#
Vectors / Vector2 X
Can Read
Cannot Write
Description#
The X component of a Vector2
Code#
using System;
using UnityEngine;
using VisualScript.Icons;
namespace VisualScript.Runtime
{
[Get]
[Title("Vector2 X")]
[Category("Vectors/Vector2 X")]
[Description("The X component of a Vector2")]
[Image(typeof(IconVector2), ColorTheme.Type.Lime, typeof(BadgeX))]
[Keywords("Value", "Component", "X", "R", "Pitch", "Right", "Side")]
[Serializable]
public class TypeNumberVector2X : TypeNumber
{
[SerializeField] private GetVector2 m_Vector2 = new GetVector2();
public override double GetPreview(GameObject source) => this.m_Vector2.GetPreview(source).x;
public override double Get(Args args)
{
return this.m_Vector2.Get(args).x;
}
public override string ToString()
{
return $"{this.m_Vector2}.x";
}
protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
}
}