How to create an object from 3D points in a text file?!


I was wondering if it is possible to create a physical object in Unity using a set of 3D points whose values have been stored in a simple text file (or say, a CSV). In other words I want to be able to create an object with many points above the "ground" level and the location of those points (vertexes) are included in a text file (X,Y,Z). Is there a way to do such primitive drawings?! I had a brief look at GL option but cannot even draw a simple line! Could someone please provide an example (script)?! Also, I would like to be able to change the file outside Unity (change the points' locations) and have the changes reflected in Unity!

Thank you in advance for your attention and kind replies.



Sure, use the Mesh class. Use System.IO for reading files. Look at the procedural examples for illustrations of how the Mesh class is used. (GL is for immediate mode, but GL.LINES draws lines without any particular difficulty, as long as you have Unity Pro.)

Almost a duplicate question to this: