string name = "Armature_Target"; GameObject go = GameObject.Find(name); if (go != null) { var comps = go.GetComponentsInChildren(); if (comps != null) { for (int j = 0; j < comps.Length; j++) { if (comps[j].GetType().Name == "DebugRigidBody") { UnityEngine.Object.DestroyImmediate(comps[j]); } } } var joints = go.GetComponentsInChildren(); if(joints != null) { for(int i = 0; i < joints.Length; i++) { Debug.Log(joints[i].gameObject.name); joints[i].gameObject.AddComponent(); } } }