//保存Texture2D为png图片
public static void SavePNG(string filePath, Texture2D texture)
{
try
{
byte[] pngData = texture.EncodeToPNG();
File.WriteAllBytes(filePath, pngData);
}
catch (Exception ex)
{
Debug.Log(ex.StackTrace);
}
}