From 43138c000dd8659bcd337fed9fe7df3e7ac46ccd Mon Sep 17 00:00:00 2001 From: madc0der Date: Mon, 28 Mar 2022 03:36:01 +0300 Subject: [PATCH] Cleanup ERPathAdapter for multi-path creator --- ERVertexPath/ERMultiRoadPathCreator.cs | 6 ++++++ 1 file changed, 6 insertions(+) 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);