static void GenerateLightmapInfo(GameObject root, List <PrefabLightmapData.RendererInfo> rendererInfos, List <Texture2D> lightmaps)
    {
        var renderers = root.GetComponentsInChildren <MeshRenderer>();

        foreach (MeshRenderer renderer in renderers)
        {
            if (renderer.lightmapIndex != -1)
            {
                PrefabLightmapData.RendererInfo info = new PrefabLightmapData.RendererInfo();
                info.renderer            = renderer;
                info.lightmapOffsetScale = renderer.lightmapScaleOffset;

                Texture2D lightmap = LightmapSettings.lightmaps[renderer.lightmapIndex].lightmapColor;

                info.lightmapIndex = lightmaps.IndexOf(lightmap);
                if (info.lightmapIndex == -1)
                {
                    info.lightmapIndex = lightmaps.Count;
                    lightmaps.Add(lightmap);
                }

                rendererInfos.Add(info);
            }
        }
    }
        public static void UpdateDependency()
        {
            GameObject go = Selection.activeGameObject;

            if (go == null)
            {
                return;
            }
            PrefabLightmapData data = go.GetComponent <PrefabLightmapData>();

            if (data == null)
            {
                return;
            }
            if (data.AllRendererInfo == null || data.AllRendererInfo.Count == 0)
            {
                return;
            }
            for (int i = 0; i < data.AllRendererInfo.Count; i++)
            {
                PrefabLightmapData.RendererInfo info = data.AllRendererInfo[i];
                info.UpdateDependency(go.transform);
                data.AllRendererInfo.RemoveAt(i);
                data.AllRendererInfo.Insert(i, info);
            }
            EditorUtility.SetDirty(go);
        }