Good day, does anyone here knows how to copy a mesh collider of a child to the parent?
you see In picture 1 where we have a gameobject that doesn’t have a mesh collider but it has a child underneath. And as inspect the child ( picture 2) it has a collider. What I want to do is copy that mesh collider to the parent in the script. I tried to do it by using the code
GameObject cloner;
MeshCollider Mcoll;
Mcoll=_loadedGameObject.GetComponentInChildren<MeshCollider>();
cloner = Instantiate(_loadedGameObject, placementPose.position, placementPose.rotation);
cloner.AddComponent(Mcoll.GetType(MeshCollider));
but the last line doesn’t work, it says ‘MeshCollider’ is a type, which is not valid in the given context
cloner.AddComponent(Mcoll.GetType(MeshCollider))