Can't color Texture2D

So, in my code I need to create 1 pixel textures just to create a colored square, but I can’t color the pixel.

Here’s my code:

Texture2D tex = new Texture2D(1, 1);
tex.SetPixel(0, 0, Color.blue);

I have tried setting the pixel position to 1, 1 aswell but it doesn’t seem to be working and the pixel apears in a light gray color.

Does anyone knows what I’m doing wrong?

tex.Apply();

You don’t know how many times I’ve missed that :).
You have to always apply the set pixels in order to get them stored properly.

Read the manual page, it might help with other SetPixel issues.

THANK YOU

Every time something goes wrong it’s something stupid like this…