Transform Local Scale Y#
Transform / Transform Local Scale Y
Can Read
Can Write
Description#
The Local Scale Y component of Transform component
Code#
using System;
using UnityEngine;
using VisualScript.Icons;
namespace VisualScript.Runtime
{
[Get, Set]
[Title("Transform Local Scale Y")]
[Category("Transform/Local Scale Y")]
[Description("The Local Scale Y component of Transform component")]
[Image(typeof(IconScale), ColorTheme.Type.Lime, typeof(BadgeY))]
[Keywords("World", "Global", "Location", "Translate")]
[Serializable]
public class TypeNumberTransformLocalScaleY : TypeNumber
{
[SerializeField] private GetGameObject m_Transform = new GetGameObject(
new GenTypeGameObject_Transform()
);
public override double Get(Args args)
{
Transform transform = this.m_Transform.Get<Transform>(args);
return transform != null ? transform.localScale.y : 0;
}
public override void Set(double value, Args args)
{
Transform transform = this.m_Transform.Get<Transform>(args);
if (transform != null)
{
Vector3 scale =new Vector3(
transform.localScale.x,
(float) value,
transform.localScale.z
);
transform.localScale = scale;
}
}
public override string ToString()
{
return $"{this.m_Transform} Local Scale.y";
}
protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
}
}