public void CreateMesh(bool fromRoad = false) { if (settings == null) { settings = RoadCreatorSettings.GetSerializedSettings(); } for (int i = 0; i < connections.Count; i++) { if (connections[i].road == null) { connections.RemoveAt(i); } } if (connections.Count < 2 && roundaboutMode == false) { RemoveIntersection(); } else { CheckMaterialsAndPrefabs(); if (resetCurvePointsOnUpdate == true) { ResetCurvePointPositions(); } if (roundaboutMode == true) { Roundabout.GenerateRoundabout(this); } else { if (outerExtraMeshesAsRoads == true) { ResetExtraMeshes(); CreateExtraMeshesFromRoads(); } GenerateMesh(); } } if (fromRoad == false) { for (int i = 0; i < connections.Count; i++) { RoadCreator roadCreator = connections[i].road.transform.parent.parent.parent.parent.GetComponent <RoadCreator>(); roadCreator.CreateMesh(true); } } }
public void CreateMesh(bool fromRoad = false) { if (settings == null) { settings = RoadCreatorSettings.GetSerializedSettings(); } for (int i = 0; i < connections.Count; i++) { if (connections[i].road == null) { connections.RemoveAt(i); } } if (connections.Count < 2 && roundaboutMode == false) { RemoveIntersection(); } else { CheckMaterialsAndPrefabs(); if (roundaboutMode == true) { Roundabout.GenerateRoundabout(this); } else { GenerateNormalMesh(); } } if (fromRoad == false) { for (int i = 0; i < connections.Count; i++) { connections[i].road.transform.parent.parent.parent.parent.GetComponent <RoadCreator>().CreateMesh(true); } } }