Distance Joint 2D Distance#
Physics 2D / Joint / Distance Joint 2D / Distance Joint 2D Distance
Can Read
Can Write
Description#
The Distance property of the Distance 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("Distance Joint 2D Distance")]
[Category("Physics 2D/Joint/Distance Joint 2D/Distance")]
[Description("The Distance property of the Distance Joint 2D component")]
[Image(typeof(IconCompass), ColorTheme.Type.Lime, typeof(Badge2D))]
[Keywords("Physics, 2D")]
[Serializable]
public class GenTypeNumber_DistanceJoint2D_Distance : TypeNumber
{
[SerializeField] private GetGameObject m_DistanceJoint2D = new GetGameObject(
new GenTypeGameObject_DistanceJoint2D()
);
public override double GetPreview(GameObject source)
{
GameObject instance = this.m_DistanceJoint2D.GetPreview(source);
if (instance == null) return default;
DistanceJoint2D component = instance.GetComponent<DistanceJoint2D>();
return component != null ? component.distance : default;
}
public override double Get(Args args)
{
DistanceJoint2D instance = this.m_DistanceJoint2D.Get<DistanceJoint2D>(args);
return instance != null
? instance.distance
: default;
}
public override void Set(double value, Args args)
{
DistanceJoint2D component = this.m_DistanceJoint2D.Get<DistanceJoint2D>(args);
if (component != null) component.distance = (float) value;
}
public override string ToString()
{
return $"{this.m_DistanceJoint2D} Distance";
}
protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
}
}