public void LegacyUpgrade()
    {
        if (!IsLegacy)
        {
            return;
        }

                #if UNITY_EDITOR
        UnityEditor.Undo.RecordObject(gameObject, "Upgrade Ferr2D Terrain");
                #endif

        Ferr2D_Path oldPath = GetComponent <Ferr2D_Path>();
        MatchOverrides();

        // upgrade the path
        pathData        = new Ferr2DPath();
        pathData.Closed = oldPath.closed;
        for (int i = 0; i < oldPath.pathVerts.Count; i++)
        {
            int            next      = Ferr.PathUtil.WrapIndex(i - 1, Path.Count, Path.closed);
            Ferr.PointType pointType = Ferr.PointType.Sharp;
            if (smoothPath)
            {
                Ferr2DT_TerrainDirection prevSegmentDirection = Ferr2D_Path.GetDirection(Path.pathVerts, next, fill == Ferr2DT_FillMode.InvertedClosed, Path.closed, directionOverrides);
                Ferr2DT_TerrainDirection nextSegmentDirection = Ferr2D_Path.GetDirection(Path.pathVerts, i, fill == Ferr2DT_FillMode.InvertedClosed, Path.closed, directionOverrides);
                if (prevSegmentDirection == nextSegmentDirection)
                {
                    pointType = Ferr.PointType.Auto;
                }
            }

            Ferr2D_PointData data = new Ferr2D_PointData();
            data.scale             = vertScales[next];
            data.directionOverride = (int)directionOverrides[next];
            data.cutOverrides      = cutOverrides[next].data;
            pathData.Add(oldPath.pathVerts[i], data, pointType);
        }
        pathData.ReverseSelf();
        pathData.SetDirty();

        // remove old path values
        directionOverrides = null;
        cutOverrides       = null;
        vertScales         = null;

        // upgrade collider settings
        if (createCollider)
        {
            if (useEdgeCollider)
            {
                colliderMode = Ferr2D_ColliderMode.Edge2D;
            }
            else if (create3DCollider)
            {
                colliderMode = Ferr2D_ColliderMode.Mesh3D;
            }
            else
            {
                colliderMode = Ferr2D_ColliderMode.Polygon2D;
            }
        }
        else
        {
            colliderMode = Ferr2D_ColliderMode.None;
        }

        // upgrade the fill settings
        switch (fill)
        {
        case Ferr2DT_FillMode.None:
            edgeMode = Ferr2D_SectionMode.Normal;
            fillMode = Ferr2D_SectionMode.None; break;

        case Ferr2DT_FillMode.Closed:
            edgeMode = Ferr2D_SectionMode.Normal;
            fillMode = Ferr2D_SectionMode.Normal; break;

        case Ferr2DT_FillMode.InvertedClosed:
            edgeMode = Ferr2D_SectionMode.Invert;
            fillMode = Ferr2D_SectionMode.Invert; break;

        case Ferr2DT_FillMode.FillOnlyClosed:
            edgeMode = Ferr2D_SectionMode.None;
            fillMode = Ferr2D_SectionMode.Normal; break;

        case Ferr2DT_FillMode.Skirt:
            edgeMode = Ferr2D_SectionMode.Normal;
            fillMode = Ferr2D_SectionMode.Normal;
            useSkirt = true; break;

        case Ferr2DT_FillMode.FillOnlySkirt:
            edgeMode = Ferr2D_SectionMode.None;
            fillMode = Ferr2D_SectionMode.Normal;
            useSkirt = true; break;
        }

        isLegacy = false;

                #if UNITY_EDITOR
        UnityEditor.Undo.DestroyObjectImmediate(oldPath);
                #else
        Destroy(oldPath);
                #endif

        Build(true);

                #if UNITY_EDITOR
        UnityEditor.SceneView.RepaintAll();
                #endif
    }