Joint 2D Attached Rigidbody#
Physics 2D / Joint / Joint 2D / Joint 2D Attached Rigidbody
Can Read
Cannot Write
Description#
The Attached Rigidbody property of the 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]
[Title("Joint 2D Attached Rigidbody")]
[Category("Physics 2D/Joint/Joint 2D/Attached Rigidbody")]
[Description("The Attached Rigidbody property of the Joint 2D component")]
[Image(typeof(IconJoint), ColorTheme.Type.Lime, typeof(Badge2D))]
[Keywords("Physics, 2D")]
[Serializable]
public class GenTypeGameObject_Joint2D_AttachedRigidbody : TypeGameObject
{
[SerializeField] private GetGameObject m_Joint2D = new GetGameObject(
new GenTypeGameObject_Joint2D()
);
public override GameObject GetPreview(GameObject source)
{
GameObject instance = this.m_Joint2D.GetPreview(source);
if (instance == null) return default;
Joint2D component = instance.GetComponent<Joint2D>();
return component != null ? component.attachedRigidbody.gameObject : default;
}
public override GameObject Get(Args args)
{
Joint2D instance = this.m_Joint2D.Get<Joint2D>(args);
return instance != null
? instance.attachedRigidbody.gameObject
: default;
}
public override U Get<U>(Args args)
{
if (typeof(U) == typeof(Joint2D))
{
Joint2D instance = this.m_Joint2D.Get<Joint2D>(args);
return instance != null
? instance.attachedRigidbody as U
: default;
}
return base.Get<U>(args);
}
public override string ToString()
{
return $"{this.m_Joint2D} Attached Rigidbody";
}
protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
}
}