public override void DestroyMeshEditor(SA2EditorMethodsInterface editorMethods) { for (int i = 0; i < meshCombiners.Count; i++) { if (meshCombiners[i].combinedMesh.targetRenderer != null) { editorMethods.Destroy(meshCombiners[i].combinedMesh.targetRenderer.gameObject); } meshCombiners[i].combinedMesh.ClearMesh(); } obj2MeshCombinerMap.Clear(); meshCombiners.Clear(); }
/// <summary> /// Creates the atlases. /// </summary> /// <returns> /// The atlases. /// </returns> /// <param name='progressInfo'> /// Progress info is a delegate function that displays a progress dialog. Can be null /// </param> /// <param name='saveAtlasesAsAssets'> /// if true atlases are saved as assets in the project folder. Othersise they are instances in memory /// </param> /// <param name='editorMethods'> /// Texture format tracker. Contains editor functionality such as save assets. Can be null. /// </param> public SAAtlasesAndRects[] CreateAtlases(ProgressUpdateDelegate progressInfo, bool saveAtlasesAsAssets = false, SA2EditorMethodsInterface editorMethods = null) { SAAtlasesAndRects[] mAndAs = null; try { mAndAs = _CreateAtlases(progressInfo, saveAtlasesAsAssets, editorMethods); } catch (Exception e) { Debug.LogError(e); } finally { if (saveAtlasesAsAssets) { //Atlases were saved to project so we don't need these ones if (mAndAs != null) { for (int j = 0; j < mAndAs.Length; j++) { SAAtlasesAndRects mAndA = mAndAs[j]; if (mAndA != null && mAndA.atlases != null) { for (int i = 0; i < mAndA.atlases.Length; i++) { if (mAndA.atlases[i] != null) { if (editorMethods != null) { editorMethods.Destroy(mAndA.atlases[i]); } else { SAUtility.Destroy(mAndA.atlases[i]); } } } } } } } } return(mAndAs); }