public static POGroup ConstructSubBuildings(ProceduralObject obj)
        {
            var logic = ProceduralObjectsLogic.instance;

            if (obj.baseInfoType != "BUILDING")
            {
                return(null);
            }
            var pos = new List <ProceduralObject>();

            pos.Add(obj);
            // Sub buildings
            var subBuildings = obj._baseBuilding.m_subBuildings;

            if (subBuildings.Length >= 1)
            {
                for (int i = 0; i < subBuildings.Length; i++)
                {
                    var subB = subBuildings[i];
                    if (subB == null)
                    {
                        continue;
                    }
                    if (subB.m_buildingInfo == null)
                    {
                        continue;
                    }
                    if (subB.m_buildingInfo.m_mesh == null)
                    {
                        continue;
                    }
                    if (!subB.m_buildingInfo.m_mesh.isReadable)
                    {
                        continue;
                    }
                    int id = 0;
                    try
                    {
                        ProceduralObject sub = new ProceduralObject();
                        id = logic.proceduralObjects.GetNextUnusedId();
                        sub.ConstructObject(subB.m_buildingInfo, id);
                        float a = -(subB.m_angle * Mathf.Rad2Deg) % 360f;
                        if (a < 0)
                        {
                            a += 360f;
                        }
                        sub.m_rotation = Quaternion.Euler(sub.m_rotation.eulerAngles.x, a, sub.m_rotation.eulerAngles.z) * obj.m_rotation;
                        sub.m_position = VertexUtils.RotatePointAroundPivot(subB.m_position + obj.m_position, obj.m_position, obj.m_rotation);
                        pos.Add(sub);
                        logic.proceduralObjects.Add(sub);
                    }
                    catch
                    {
                        if (id != 0)
                        {
                            if (logic.activeIds.Contains(id))
                            {
                                logic.activeIds.Remove(id);
                            }
                        }
                    }
                }
            }
            if (pos.Count < 2)
            {
                return(null);
            }
            var group = POGroup.MakeGroup(logic, pos, pos[0]);

            return(group);
        }