ProceduralPrimitives

Author: Bérenger.

Description
Use those scripts to procedurally create primitive meshes, with custom parameters. More to come later. If anyone has the code for a teapot, that'd be great. I guess it's a tiny bit more complicated though.

Usage
The entry point of those script must be a reference to a meshfilter's mesh. The return value is that mesh filled up.

C# - Cone
Note that cylinders (bottomRadius == topRadius) and pyramids (4 sides, topRadius == 0) are types of cones, and can be created with this script.

C# - Sphere
Regular sphere. Source : http://stackoverflow.com/questions/4081898/procedurally-generate-a-sphere-mesh

C# - IcoSphere
This is a sphere without poles. Source : http://blog.andreaskahler.com/2009/06/creating-icosphere-mesh-in-code.html

Note : Don't forget to include System.Collections.Generic. And there is no UV yet, not sure how to go about it actually.

Tips
Dealing with all thoses vertices and indexes can give you a headache before you know it. To see things clearly, you can create a TextMesh, set it up properly (small characters, anchor at middle-center) and save it as a prefab. Then, instantiate one at each vertices to see those indexes, like so :

PS : A lookat script might be usefull on those guys, with the editor's cam as target (Camera.current).