private static void ImportLinkData(this UrdfLink urdfLink, Link link, Joint joint) { if (link.inertial == null && joint == null) { urdfLink.IsBaseLink = true; } urdfLink.gameObject.name = link.name; if (joint?.origin != null) { UrdfOrigin.ImportOriginData(urdfLink.transform, joint.origin); } if (link.inertial != null) { UrdfInertial.Synchronize(urdfLink.gameObject, link.inertial); if (joint != null) { UrdfJoint.Synchronize(urdfLink.gameObject, UrdfJoint.GetJointType(joint.type), joint); } } else if (joint != null) { Debug.LogWarning("No Joint Component will be created in GameObject \"" + urdfLink.gameObject.name + "\" as it has no Rigidbody Component.\n" + "Please define an Inertial for Link \"" + link.name + "\" in the URDF file to create a Rigidbody Component.\n", urdfLink.gameObject); } foreach (Joint childJoint in link.joints.Where(x => x.ChildLink != null)) { Link child = childJoint.ChildLink; UrdfLinkExtensions.Synchronize(urdfLink.transform, child, childJoint); } var linkChildren = Utils.GetComponentsInDirectChildrenFromGameobject <UrdfLink>(urdfLink.gameObject); List <string> wantedObjectNames = link.joints .Where(x => x.ChildLink != null) .Select(x => String.IsNullOrEmpty(x.child) ? Utils.GenerateNonReferenceID(x.ChildLink) : x.child) .ToList(); linkChildren.RemoveAll(x => wantedObjectNames.Contains(x.name)); Utils.DestroyAll(linkChildren.Select(x => x.gameObject)); }