unity里面获取图片像素坐标问题

这里写图片描述
为了知道unity里,texture.GetPixels()里每个像素的颜色到底是怎么样分布的,我们进行了一个测试。上图是一个4*4的贴图,ps和unity里显示都是这样。

public class testCol:MonoBehaviour  {
    public Texture2D texture;
    public void OnClick()
    {
        Color[] textureCol = texture.GetPixels();
        for(int i = 0; i < textureCol.Length; i++)
        {
            Debug.LogError(textureCol[i].ToString());
        }

    }
}

运行下面的代码,输出结果如下:
这里写图片描述
也就是说,像素分布如下所示:
这里写图片描述

猜你喜欢

转载自blog.csdn.net/qq_18229381/article/details/80527497