2D attaching Joint With Script ?

hi, 'm trying to Connect two 2d object with a C# Script , i have a Variable type Parts Gameobject ,adding the Parts Children, so i try link some objects to a Central object but i have a problem to get the Parts Childrens and do Link to the Central Object . Thanks to thoose who can help me :v

There’s really no way to attach 2 objects together using unity because it’s not a software that works with the mesh or the sprites (Imported info) so you can decleer a new empty game object like this :-
public GameObject parentObject = New GameObject (Vectro3, Vector3);
set the transform as you like

public GameObject obj_1; public GameObject obj_2;

then set the 2 game objects to become Children of the parent obj

`void Update ()
{
obj_1.transform.parent = parentObject.transform;
obj _2.transform.parent = parentObject.transform;
}`

if you are using a sprite software to make this 2D game, it will be best to use this way.
if you are using Mesh in 3D or 2D game, so you better do it by your own by setting a new empty object in the scene and get one of those 2 objs to it then set it to the project asset folder then put the other object and then drag and put it again into the project asset folder,

this simple trick can attach them both. try it or see “how to save a prefab into a file in the window” to do this trick I told you in the docs : Windows - write all bytes
I can’t teach this thing because I didn’t try it before

I hope this will help :slight_smile: