protected override void GenerateTexture()
{
string savePath = EditorUtility.SaveFilePanel("Choose where to save the texture.",
Application.dataPath, "MyTex.png", "png");
if (savePath.Length == 0)
{
return;
}
//Write out the texture as a PNG.
Texture2D noiseTex = GetPreview(false);
try
{
File.WriteAllBytes(savePath, noiseTex.EncodeToPNG());
}
catch (Exception e)
{
Debug.LogError("Unable to save texture to file: " + e.Message);
}
//Finally, open explorer to show the user the texture.
EditorUtility.RevealInFinder(StringUtils.FixDirectorySeparators(savePath));
}