Texture2D.GetPixels() returns upside-down pixel data?

I’m writing an editor script which (among other things) analyzes a texture. I loop through the array with a nested loop examining the pixel data, and it’s fine on the x axis, but it’s flipped on the y axis. That is to say where the docs say:

In order to be accurate with what I’m getting, they would really have to say:

For reference, the image I’m using is 640x480, mipmaps are disabled, texture compression is disabled, power-of-two resizing is disabled, and read/write is (of course) enabled. However, I’ve tried changing all of those settings (except for the read/write checkbox, obviously) and none of them seem to affect anything.

Any idea what’s going wrong here?

The docs are wrong.

–Eric

Oh really? It’s intended to work this way? Well at least that means I don’t have to keep an eye out for updates which might cause my code to need rewriting. Thanks Eric.

how did you fix this?

Edit the html file for the doc page so it says “bottom to top” rather than “top to bottom”. :slight_smile: There isn’t anything else to fix.

–Eric

You might find it difficult to get access to the doc sources from where you are. I’ve passed this on to our technical writer, Juan, just to be on the safe side :wink: