I'm making a game where the player has to draw lines. I'm using Graphics.DrawMesh, but I can't find a way to convert the line into a GameObject. I need it to be a GameObject because it needs to detect collisions.
PS: This might be stupid, but I'm pretty new with Unity.
Thanks in advance!
You will probably have to do it procedurally. Try something like this:
var newObj : GameObject = new GameObject(objectName); newObj.AddComponent(MeshFilter); newObj.AddComponent(MeshRenderer); var mesh = new Mesh (); // <---- the mesh you created newObj.GetComponent(MeshFilter).mesh = mesh;
answered Jul 06 '12 at 08:37 PM