Accessing pixel values of Texture2D

Massive sorry for necroing this topic. I used the code proposed by and it worked perfectly in development. Sadly when I finished the project and am building it for my target platform (iOS) I get this error:

UATHelper: Packaging (iOS):     [113/541] Compile MazeOnGameModeBase.cpp
UATHelper: Packaging (iOS):     C:\Users\aless\Documents\Unreal Projects\MazeOn\Source\MazeOn\MasterMaze.cpp:84:23: error: static_cast from 'unsigned char *' to 'FColor *' is not allowed
UATHelper: Packaging (iOS):             FColor* MazeLayout = static_cast<FColor*>(Layout->PlatformData->Mips[0].BulkData.Lock(LOCK_READ_ONLY));
UATHelper: Packaging (iOS):                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PackagingResults: Error: static_cast from 'unsigned char *' to 'FColor *' is not allowed
UATHelper: Packaging (iOS):     [114/541] Compile MasterMaze.gen.cpp

Any ideas on how to solve this?

I have the same error as Al Ananias. It must be a problem that came with one of the recent unreal engine versions.

Absolute legend TheKaosSpectrum sorted it in this post: link text

So by your code you are interogating only one pixel here at location x,y of 5,10 ?

I mean not alot in this

if( PixelX >= 0 && PixelX < TextureWidth && PixelY >= 0 && PixelY < TextureHeight )

If PixelX that is pixel number 5 is bigger than zero and pixelX is smaller than TextureWidth then do something.

PixelColor = FormatedImageData[ PixelY * TextureWidth + PixelX ];

So if meets this requirements then it’s added to Pixel Color but this is just 0 to 1 ? where is the mechanism for looking up the shades of gray for the heightmap between black and white there they are.

This is not good for heigthmaps, or maybe I’m wrong and not reading it properly.

So in Pixel color I guess it records the color code or does it record 1 or 0 ?

If anyone can explain what this really represents in the bigger picture of this code.

uint8 PixelX = 5, PixelY = 10;

So is it just the 5,10 x,y coords position on the texture or is it a range that represents an area on the texture ?