How to make a custom GUITexture at runtime?

I want to make a simple app which has a GUITexture in the middle of the screen, the GUITexture has a Texture2D texture, which is a blue rectangle made somehow with SetPixels().. Im really new to Unity, and i cant make it work.. How to do this? And if im wrong, and it cant be made this way, then how to make a gui element which pixels can be modified at runtime?

Make a Color array filled with blue and assign that to a texture using SetPixels. Then assign that texture to the texture property of the GUITexture object.

Thanks Eric5h5, that answers my question too. Here's the code (C#) ...


GameObject obj = new GameObject("SolidColour");
obj.AddComponent("GUITexture");
obj.transform.localScale = Vector3.zero;
obj.guiTexture.pixelInset = new Rect(0,0,40, 20);
Texture2D tex2d = new Texture2D(1, 1);
tex2d.SetPixels(new Color[1] { Color.red });
tex2d.Apply();
obj.guiTexture.texture = tex2d;