public void ClearRoad() { erRoad = erRoadNetwork.GetRoadByGameObject(road.objectReferenceValue as GameObject); if (erRoad == null) { Debug.LogError("No road gameobject specified"); return; } // the mask didn't get refreshed with the road, it stayed the old one => according to raoul this helps: Object.DestroyImmediate(erRoad.gameObject.GetComponent <AwesomeTechnologies.VegetationMaskLine>()); // delete all markers // TODO: find out how to do that properly while (erRoad.GetMarkerCount() > 0) { erRoad.DeleteMarker(0); } erRoad.Refresh(); }