I do this:
sourceTexture = zedCam.CreateTextureImageType(sl.VIEW.DEPTH);
material.mainTexture = sourceTexture;
Color[] pixels = sourceTexture.GetPixels();
And pixels is filled with identical grey values for every pixel in sourceTexture. If I apply sourceTexture to a material, as shown in line 1, it looks correct. It is a black and white depth map from a camera feed.
I’ve tried iterating with GetPixel instead, same result. Also tried using GetPixels32 and a Color32 array. Also tried Color[] pixels = sourceTexture.GetPixels(0,0, sourceTexture.width, sourceTexture.height, 0) for the third line.
I’m doing this because I need the gray-scale values from sourceTexture.