Automatic LOD

There is this great tutorial on youtube.

it set’s you LOD models automaticly, i really have a project that needs this approach.
but it doesn’t work in unity 2017.3
Can somebody fix the code.

thanks…

using System.Collections;
using UnityEngine;

public class AutoLOD : MonoBehaviour
{

    public float[] lodSizes = new float[3] { .7f, .5f, .0f };

    [ContextMenu("LOD")]
    void LOD()
    {
        //initializeGroups
        GameObject groups = new GameObject("LODs");
        groups.transform.SetParent(gameObject.transform);
        int mainChildCount = gameObject.transform.childCount;

        int childCount = gameObject.transdorm.GetChild(0).childCount;
        for (int i = 0; i < childCount; i++)
        {
            GameObject lodGroup = new GameObject("LODGroup" + i);
            lodGroup.transform.SetParent(groups.transform);
            lodGroup.AddComponent<lodGroup>();
        }
        for (int e = 0; e < mainChildCount - 1; e++)
        {
            for (int i = 0; i < childCount; i++)
            {
                GameObject newLOD = (GameObject)Instantiate(gameObject.transform.GetChild(e).transform.GetChild(i).gameObject);
                newLOD.name = newLOD.name + "_LOD" + e;
                newLOD.transform.SetParent(gameObject.transform.Find("LODs").transform.GetChild(i));
            }
        }
        LODGroup[] LODGroups = gameObject.transform.GetChild(mainChildCount - 1).GetComponentsInChildren<LODGroups>();
        int index = 0;

        foreach (LODGroup group in LODGroups)
        {
            LOD[] lods = new LOD[mainChildCount - 1];

            for (int i = 0; i < mainChildCount - 1; i++)
            {
                Renderer[] renderers = new Renderer[1];
                renderers[0] = gameObject.transform.GetChild(mainChildCount - 1).transform.GetChild(index).transform.GetChild(i).GetComponent<renderers>();
                lods[i] = new LOD(lodSizes[i], renderers);
            }
            groups.SetLODs(lods);
            groups.RecalculateBounds();
            index++;
        }
    }
}

How do you expect anyone to fix this for you when you haven’t even said what isn’t working in it?

Sorry…it is the update from an older unity version…is isn working in the new version