Take a look at this post. It looks like you are doing the-same thing as that person which is to get Texture from an image and average the pixel.
The reason I don't consider this a duplicate is because you want to get a pixels from specific(4x4) area not all pixels from the texture.
Texture2D.GetPixel or Texture2D.GetPixels32 might be better,
Because you want to do this on speficic pixels, you can't do it with Texture2D.GetPixel
or Texture2D.GetPixels32
. You don't even need the UniversalMediaPlayer plugin you are using.
You can do this with the GetPixels
function. Notice the 's' at the end.
This is the function prototype:
Color[] GetPixels(int x, int y, int blockWidth, int blockHeight);
Depending on the position of the pixels you want to read from the Texture it should look something like this:
Color[] texColors = tex.GetPixels(0, 0, 4, 4);
You need to use that instead of Color32[] texColors = tex.GetPixels32();
from this answer.
Note:
You can still use your UniversalMediaPlayer video plugin if you prefer it over Unity's new VideoPlayer. The GetPixels
solution should still work.