GenerateUV for lightmapping

How can I use PolygonModifier.GenerateUV method to create UVs to use them for lightmapping? Actually, how does GenerateUV algorithm based on normal data works? Are there any references?

@Anton.Akzhigitov

The GenerateUV calculates which plane (xy, xz,yz) the polygon should be projected to, based on the normal data, and project the control point to that plane, projected 2D value is the calculated UV.

There’s no universal algorithm for generating UV, usually you need to unwrap the UV in 3D tools and manually edit them. The GenerateUV provided by PolygonModifier is a simple implementation.