diff --git a/ERVertexPath/ERMultiRoadPathCreator.cs b/ERVertexPath/ERMultiRoadPathCreator.cs index 0943f1c..8cc8dc2 100644 --- a/ERVertexPath/ERMultiRoadPathCreator.cs +++ b/ERVertexPath/ERMultiRoadPathCreator.cs @@ -118,6 +118,12 @@ namespace ERVertexPath positionIndex = vertexList.Count; } + var adapters = gameObject.GetComponents(); + foreach (var adapter in adapters) + { + DestroyImmediate(adapter); + } + unionAdapter = gameObject.AddComponent(); unionAdapter.InitFromData(totalDistance, vertexList.ToArray(), directionsList.ToArray(), normalsList.ToArray(), rotationsList.ToArray(), distanceList.ToArray(), startIndexToRoad);