static function SaveFilePanelInProject (title : String, defaultName : String, extension : String, message : String) : String
Description
Displays the "save file" dialog in the Assets folder of the project and returns the selected path name.
See Also: SaveFilePanel function.

Save File panel in project.
import System.IO;
@MenuItem("Examples/Save Texture to file")
static function Apply () {
var texture : Texture2D = Selection.activeObject as Texture2D;
if(!texture) {
EditorUtility.DisplayDialog("Select Texture",
"You Must Select a Texture first!",
"Ok");
return;
}
var path = EditorUtility.SaveFilePanelInProject("Save texture as PNG",
texture.name + ".png",
"png",
"Please enter a file name to save the texture to");
if(path.Length != 0) {
if(texture.format != TextureFormat.ARGB32 && texture.format != TextureFormat.RGB24) {
var newTexture = Texture2D(texture.width, texture.height);
newTexture.SetPixels(texture.GetPixels(0),0);
texture = newTexture;
}
var pngData = texture.EncodeToPNG();
if(pngData != null) {
File.WriteAllBytes(path, pngData);
AssetDatabase.Refresh();
}
}
}