How to attach a mesh created with Graphics.DrawMesh to a GameObject?

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);
				var mesh = new Mesh (); // <---- the mesh you created
				newObj.GetComponent(MeshFilter).mesh = mesh;