We're trying to get the RGB values of the Vuforia background image, took by the camera.
We get the background image by doing this:
Texture renderText; renderText = VuforiaRenderer.Instance.VideoBackgroundTexture; Texture2D Text2D = renderText as Texture2D;
GameObject Go = GameObject.Find("BackgroundPlane"); MeshRenderer MR = Go.GetComponent<MeshRenderer>(); Texture2D Text2D = MR.materials.mainTexture as Texture2D;
After this, we can assign this Texture 2D as the texture of a UI Raw Image and it works properly on every platform.
When we try to read its pixel values
Color32 cols = Text2D.GetPixels32(); string n = ""; for (int i = 0; i < 5; i++) n += cols[i]; print(n);
the Unity Editor will successfully return the color of the given pixel - for example "RGBA(110, 130, 143, 225)".
However, an Android build will always return "RBA(0, 0, 0, 0)".
Do you know a way around this problem?