Slider Joint 2D Angle#
Physics 2D / Joint / Slider Joint 2D / Slider Joint 2D Angle
Can Read
Can Write
Description#
The Angle property of the Slider Joint 2D component
Code#
// <auto-generated>
// This script was automatically generated using the Visual Script Transpiler.
// Do not modify. Changes to this file will be lost when updating the package.
// </auto-generated>
using System;
using UnityEngine;
using VisualScript.Icons;
namespace VisualScript.Runtime
{
[Get]
[Set]
[Title("Slider Joint 2D Angle")]
[Category("Physics 2D/Joint/Slider Joint 2D/Angle")]
[Description("The Angle property of the Slider Joint 2D component")]
[Image(typeof(IconSliderJoint), ColorTheme.Type.Lime, typeof(Badge2D))]
[Keywords("Physics, 2D")]
[Serializable]
public class GenTypeNumber_SliderJoint2D_Angle : TypeNumber
{
[SerializeField] private GetGameObject m_SliderJoint2D = new GetGameObject(
new GenTypeGameObject_SliderJoint2D()
);
public override double GetPreview(GameObject source)
{
GameObject instance = this.m_SliderJoint2D.GetPreview(source);
if (instance == null) return default;
SliderJoint2D component = instance.GetComponent<SliderJoint2D>();
return component != null ? component.angle : default;
}
public override double Get(Args args)
{
SliderJoint2D instance = this.m_SliderJoint2D.Get<SliderJoint2D>(args);
return instance != null
? instance.angle
: default;
}
public override void Set(double value, Args args)
{
SliderJoint2D component = this.m_SliderJoint2D.Get<SliderJoint2D>(args);
if (component != null) component.angle = (float) value;
}
public override string ToString()
{
return $"{this.m_SliderJoint2D} Angle";
}
protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
}
}