using UnityEngine;
using System.Collections;

public class changingTest : MonoBehaviour {

	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
        if (Input.GetKeyDown("space"))
        {
  
            GameObject o = GameObject.Find("CosaRara");
            SkinnedMeshRenderer r = o.GetComponent<SkinnedMeshRenderer>();
            GameObject leg = (GameObject)Instantiate(Resources.Load("pir"));
            r.sharedMesh = GameObject.Find("Cone").GetComponent<SkinnedMeshRenderer>().sharedMesh;
            //r.transform.position = new Vector3(-2, 2, -1);
            //r.name = "Cube.001";

            
            //newObj.transform.position = o.transform.position;
            //newObj.name = o.name;

            //Mesh oldMesh = o.GetComponent<SkinnedMeshRenderer>().sharedMesh;
            //Mesh newMesh = (Mesh) Object.Instantiate(oldMesh);
            //newObj.AddComponent<SkinnedMeshRenderer>();
            //SkinnedMeshRenderer s = newObj.GetComponent<SkinnedMeshRenderer>();
            //s.sharedMesh = sp.GetComponent<SkinnedMeshRenderer>().sharedMesh;
            //      o.GetComponent<SkinnedMeshRenderer>();

            //newObj.AddComponent<Animation>; newObj.GetComponent<Animation>() = o.transform.animation;
            //newObj.transform.parent = o.transform.parent;
            //GameObject.DestroyImmediate(o);
            //GameObject.DestroyImmediate(leg);
            
        }
 
	
	}
}
