copy settings from other gameobject

hi,

i got an game object with components & scripts attached to it. if the player clicks on a gui button the engine needs to destroy the current object and load a new object with the same component scripts settings position etc. (like a swap of objects)

this is what i got

var pos : Rect;
var pos2 : Rect;

function OnGUI()
{
  if (GUI.Button(pos, " Swap "))
  {
   Destroy (gameObject);

player = new GameObject ("the new gameobject");
player.AddComponent ("Rigidbody");
player.AddComponent ("SphereCollider");
player.AddComponent ("Mesh Renderer");
player.AddComponent ("Drag NRotate 2");
  }

greetz

Perhaps you could just use Instantiate to create the new object, then destroy the old object. Eg:

var newObject = Instantiate(oldObject);
Destroy(oldObject);

If the settings are always the same, just instantiate a prefab. If not, then write a method which will copy all the values (like position, mass etc.) from one object to another.