public void RenderAllIcons() { this.Editor.gameObject.SetActive(true); if (!Directory.Exists("c:/test/icons")) { Directory.CreateDirectory("c:/test/icons"); } Skinnable[] all = Skinnable.All; for (int i = 0; i < (int)all.Length; i++) { Skinnable skinnable = all[i]; this.Editor.StartNewItem(skinnable.Name); PropRenderer.RenderScreenshot(this.Editor.Prefab, string.Concat("c:/test/icons/", skinnable.Name, ".png"), 512, 512, 4); int num = 0; UnityEngine.Mesh[] meshDownloads = skinnable.MeshDownloads; for (int j = 0; j < (int)meshDownloads.Length; j++) { UnityEngine.Mesh mesh = meshDownloads[j]; if (mesh != null && mesh.isReadable) { mesh.Export(string.Format("c:/test/icons/{0}{1}.obj", skinnable.Name, num)); num++; } } } this.Editor.gameObject.SetActive(false); }
private IEnumerator DoDownloadModel() { WorkshopItemEditor workshopItemEditor = null; yield return(workshopItemEditor.StartCoroutine(workshopItemEditor.FileDialog.Save(null, ".obj", "SAVE FILE", null, true))); if (string.IsNullOrEmpty(workshopItemEditor.FileDialog.result)) { yield break; } UnityEngine.Debug.Log(string.Concat("Save Obj to ", workshopItemEditor.FileDialog.result)); for (int i = 0; i < (int)workshopItemEditor.Skinnable.MeshDownloads.Length; i++) { UnityEngine.Mesh meshDownloads = workshopItemEditor.Skinnable.MeshDownloads[i]; if (meshDownloads != null && meshDownloads.isReadable) { string fileDialog = workshopItemEditor.FileDialog.result; if (i > 0) { fileDialog = fileDialog.Replace(".obj", string.Format("_{0}.obj", i)); } meshDownloads.Export(fileDialog); } } }