有任何问题可以添加 QQ群 207019099
Color[] colors = new Color[tex.width / 2];
tex.SetPixels(tex.width / 2, tex.height / 2, tex.width / 2, 1, colors);
tex.SetPixels(tex.width / 2, tex.height / 2, 1, tex.height / 2, colors);
//将RenderTexture保存成一张png图片
public bool SaveRenderTextureToPNG(byte[] bytes, string contents, string pngName)
{
if (!Directory.Exists(contents))
Directory.CreateDirectory(contents);
FileStream file = File.Open(contents + “/” + pngName + “.png”, FileMode.Create);
BinaryWriter writer = new BinaryWriter(file);
writer.Write(bytes);
file.Close();
return true;
}