public void GeneratePrototypes() { #if UNITY_EDITOR Undo.RecordObject(this, "GPUI Set Map Magic Import"); if (terrainSettings != null) { AssetDatabase.DeleteAsset(AssetDatabase.GetAssetPath(terrainSettings)); } #endif // import terrain details detailPrototypes = new List <GPUInstancerPrototype>(); if (importDetails) { GenerateMapMagicTerrainSettings(); GPUInstancerUtility.SetDetailInstancePrototypes(gameObject, detailPrototypes, terrainDetailPrototypes.ToArray(), 2, terrainSettings, true); } // import terrain trees treePrototypes = new List <GPUInstancerPrototype>(); if (importTrees) { GenerateMapMagicTerrainSettings(); GPUInstancerUtility.SetTreeInstancePrototypes(gameObject, treePrototypes, terrainTreePrototypes.ToArray(), terrainSettings, true); } // import prefabs prefabPrototypes = new List <GPUInstancerPrototype>(); if (importObjects) { GPUInstancerUtility.SetPrefabInstancePrototypes(gameObject, prefabPrototypes, selectedPrefabs, true); } else { selectedPrefabs.Clear(); } foreach (GameObject notSelectedPrefab in prefabs.FindAll(p => !selectedPrefabs.Contains(p))) { if (notSelectedPrefab.GetComponent <GPUInstancerPrefab>() != null) { DestroyImmediate(notSelectedPrefab.GetComponent <GPUInstancerPrefab>(), true); #if UNITY_EDITOR EditorUtility.SetDirty(notSelectedPrefab); #endif } } #if UNITY_EDITOR AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); #endif }