using UnityEngine;
using System.Collections;
using UnityEditor;


// Needed to create meshs.

public class MeshCorrection : MonoBehaviour {




		public Mesh myMesh;
	// Use this for initialization
	void Start () {
				//CorrectMesh (myMesh);
				//CopyMesh(myMesh);
				Mesh newmesh = new Mesh();
				newmesh.vertices = myMesh.vertices;
				newmesh.triangles = myMesh.triangles;
				newmesh.uv = myMesh.uv;
				newmesh.normals = myMesh.vertices;
				newmesh.colors = myMesh.colors;
				newmesh.tangents = myMesh.tangents;
				//CorrectMesh (newmesh);
				AssetDatabase.CreateAsset(newmesh,"Assets/MyCircle.asset");
				AssetDatabase.Refresh ();
				// Mesh myNewMesh = Object.Instantiate (myMesh);
				//AssetDatabase.CreateAsset(myNewMesh,"Assets/MyCube.obj");

	}
	


		private void CorrectMesh(Mesh aMesh){
				int length = aMesh.vertices.Length;
				float distance;
				for (int i = 0; i < length; i++) {
						//distance = aMesh.vertices [i].magnitude;
						//print (aMesh.vertices [i]);
						aMesh.normals [i] = aMesh.vertices [i];

				}
		}
}
