void OnGUI()
    {
        modelAssetLoader = GameObject.FindObjectOfType <ModelAssetLoader>();
        if (modelAssetLoader == null)
        {
            Debug.LogError("modelAssetLoader == null");
            return;
        }

        sortComponent.OnGUI();

        var root = GameObject.FindObjectOfType <ModelAssetLoader>();

        if (root)
        {
            var allCount = EditorHelper.GetVertexs(root.gameObject);
            GUILayout.Label("AllCount:" + allCount, EditorStyles.boldLabel);
        }

        var heightOffset = 100;

        scrollPos = EditorGUILayout.BeginScrollView(scrollPos, GUILayout.Width(position.width), GUILayout.Height(position.height - heightOffset));//开始滚动条

        GUI_InitTableComponent();

        var meshRenderers = GameObject.FindObjectsOfType <MeshRenderer>().ToList();

        meshRenderers.Sort(sortComponent.SortMethod);
        //模型按从位置进行排序
        for (int i = 0; i < meshRenderers.Count; i++)
        {
            EditorGUILayout.BeginHorizontal();
            GUILayout.Label(string.Format("{0:00}", i + 1), tableComponent.GetGUIWidth("ID"));
            MeshRenderer meshRenderer = meshRenderers[i];
            var          obj          = meshRenderer.gameObject;
            var          vertexCount  = EditorHelper.GetVertexs(obj);
            GUILayout.Label(vertexCount + "", tableComponent.GetGUIWidth("Count"));
            if (GUILayout.Button(obj.name, tableComponent.GetGUIWidth("Name")))
            {
                EditorHelper.SelectObject(obj);
            }

            GameObject simpleOjb = GetSimpleModel(obj);
            EditorGUILayout.ObjectField(simpleOjb, typeof(GameObject), false, tableComponent.GetGUIWidth("Simple"));

            var vertexCount2 = 0;
            if (simpleOjb != null)
            {
                vertexCount2 = EditorHelper.GetVertexs(simpleOjb);
                GUILayout.Label(vertexCount2 + "", tableComponent.GetGUIWidth("Count2"));
            }
            else
            {
                GUILayout.Label(vertexCount2 + "", tableComponent.GetGUIWidth("Count2"));
            }


            if (GUILayout.Button("CreatePrefab"))
            {
                CreatePrefab(obj, true, vertexCount <= vertexCount2);
            }
            //if (GUILayout.Button("Rename"))
            //{
            //    RenameAsset(obj);
            //}
            if (vertexCount > vertexCount2)
            {
                if (GUILayout.Button("ReplaceSimple"))
                {
                    ReplaceSimple(obj, simpleOjb);
                }
            }
            else
            {
                if (GUILayout.Button("------------"))
                {
                    //ReplaceSimple(obj, simpleOjb);
                }
            }

            //if (GUILayout.Button("ReplaceSimple"))
            //{
            //    //RenameAsset(obj);
            //}
            EditorGUILayout.EndHorizontal();
        }

        EditorGUILayout.EndScrollView();

        EditorGUILayout.BeginHorizontal();
        if (GUILayout.Button("CreatePrefab"))
        {
            modelAssetLoader.modelList.Clear();
            for (int i = 0; i < meshRenderers.Count; i++)
            {
                MeshRenderer meshRenderer = meshRenderers[i];
                var          obj          = meshRenderer.gameObject;
                //CreatePrefab(obj,false);

                GameObject simpleOjb = GetSimpleModel(obj);
                if (simpleOjb != null)
                {
                    var vertexCount  = EditorHelper.GetVertexs(obj);
                    var vertexCount2 = EditorHelper.GetVertexs(simpleOjb);
                    if (vertexCount > vertexCount2)
                    {
                        //ReplaceSimple(obj, simpleOjb);
                        CreatePrefab(obj, false, false);//还没有替换简化模型
                    }
                    else
                    {
                        CreatePrefab(obj, false, true);//已经替换了建行模型
                    }
                }
                else
                {
                    CreatePrefab(obj, false, false);//不存在简化模型
                }
            }
        }
        if (GUILayout.Button("ReplaceSimple"))
        {
            for (int i = 0; i < meshRenderers.Count; i++)
            {
                MeshRenderer meshRenderer = meshRenderers[i];
                var          obj          = meshRenderer.gameObject;


                GameObject simpleOjb = GetSimpleModel(obj);
                if (simpleOjb != null)
                {
                    var vertexCount  = EditorHelper.GetVertexs(obj);
                    var vertexCount2 = EditorHelper.GetVertexs(simpleOjb);
                    if (vertexCount > vertexCount2)
                    {
                        ReplaceSimple(obj, simpleOjb);
                    }
                }
            }
        }
        if (GUILayout.Button("RenameModel"))
        {
            for (int i = 0; i < meshRenderers.Count; i++)
            {
                MeshRenderer meshRenderer = meshRenderers[i];
                var          obj          = meshRenderer.gameObject;
                RenameAsset(obj);
            }
        }
        if (GUILayout.Button("RenameSimple"))
        {
            string path  = "Assets/Models/SiHuiFactory/J1_Devices/简化模型";
            var    guids = AssetDatabase.FindAssets("t:model", new string[] { path });//再找模型
            foreach (var guid in guids)
            {
                var assetPath = AssetDatabase.GUIDToAssetPath(guid);
                //Debug.Log(assetPath);
                var obj = AssetDatabase.LoadAssetAtPath <GameObject>(assetPath);
                //主厂房设备简化1.FBX
                RenameAsset(obj);
            }
        }
        EditorGUILayout.EndHorizontal();
    }