Unity3D Texture2D

            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);
Unity3D Texture2D_第1张图片
屏幕快照 2016-07-28 下午8.07.33.png

你可能感兴趣的:(Unity3D Texture2D)