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