Calculating mesh tris at runtime

I’m trying to build meshes at runtime and I need to calculate the tris. It’s pretty complicated apparently. Does anyone know maybe if there’s a plugin to calculate things like that or even something inside unity. Given a shape divide to triangles or something like that

If you are talking about 2D shapes:

http://wiki.unity3d.com/index.php/Triangulator