Documentation index for AI agents (llms.txt) A Markdown version of every page is available: request the page's source under /docs/, follow the "alternate" link in this page's head, or start from /llms.txt.
Visual Script logo Manual

Joint 2D Connected Body#

Physics 2D / Joint / Joint 2D / Joint 2D Connected Body

  • Can Read

  • Can Write

Description#

The Connected Body 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]
    [Set]
    
    [Title("Joint 2D Connected Body")]
    [Category("Physics 2D/Joint/Joint 2D/Connected Body")]
    [Description("The Connected Body property of the Joint 2D component")]
    
    [Image(typeof(IconJoint), ColorTheme.Type.Lime, typeof(Badge2D))]
    [Keywords("Physics, 2D")]
    
    [Serializable]
    public class GenTypeGameObject_Joint2D_ConnectedBody : 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.connectedBody.gameObject : default;
        }
        
        public override GameObject Get(Args args)
        {
            Joint2D instance = this.m_Joint2D.Get<Joint2D>(args);
            return instance != null
                ? instance.connectedBody.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.connectedBody as U
                    : default;
            }
            
            return base.Get<U>(args);
        }
        
        public override void Set(GameObject value, Args args)
        {
            Joint2D component = this.m_Joint2D.Get<Joint2D>(args);
            if (component != null) component.connectedBody = (Rigidbody2D) value.Get<UnityEngine.Rigidbody2D>();
        }
        
        public override void Set<U>(U value, Args args)
        {
            if (typeof(U) == typeof(Rigidbody2D))
            {
                Joint2D component = this.m_Joint2D.Get<Joint2D>(args);
                if (component != null) component.connectedBody = value as Rigidbody2D;
            }
            
            base.Set<U>(value, args);
        }
        
        public override string ToString()
        {
            return $"{this.m_Joint2D} Connected Body";
        }
        
        protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
    }
}

Visual Script logoVisual Script © Catsoft Works 2026. All rights reserved.