[csharp] view plaincopyprint?在CODE上查看代码片派生到我的代码片 using UnityEngine; using System.Collections; public class CombineMeshes : MonoBehaviour { void Start() { MeshFilter[] meshFilters = GetComponentsInChildren(); CombineInstance[] combine = new CombineInstance[meshFilters.Length]; int i = 0; while (i < meshFilters.Length) { combine[i].mesh = meshFilters[i].sharedMesh; combine[i].transform = meshFilters[i].transform.localToWorldMatrix; meshFilters[i].gameObject.SetActive(false); i++; } transform.GetComponent ().mesh = new Mesh(); transform.GetComponent ().mesh.CombineMeshes(combine); transform.gameObject.SetActive(true); } } [csharp] view plaincopyprint?在CODE上查看代码片派生到我的代码片 using UnityEngine; using System.Collections; using UnityEditor; public class EditorTools : MonoBehaviour { [MenuItem("Tools/Save Combine Mesh")] public static void SaveMesh() { Mesh m = Selection.activeGameObject.GetComponent ().sharedMesh; AssetDatabase.CreateAsset(m, "Assets/tmp/cmbMesh.asset"); AssetDatabase.SaveAssets(); } }