Color32[] colors = new Color32[4];
colors [0] = Color.red;
colors [1] = Color.black;
colors [2] = Color.blue;
colors [3] = Color.green;
texture = new Texture2D (2,2,TextureFormat.RGBA32,false);
texture.SetPixels32 (colors);
texture.Apply ();
byte[] bytes = texture.EncodeToPNG ();
File.WriteAllBytes (Application.dataPath+"/tttt.png",bytes);

屏幕快照 2016-07-28 下午8.07.33.png