I am using the following code to create a GUITexture at runtime:
MapIcon.AddComponent("GUITexture"); Texture2D tex = new Texture2D(1,1); tex.SetPixel(0,0,Color.blue); MapIcon.GetComponent<GUITexture>().texture = tex; MapIcon.GetComponent<GUITexture>().color = Color.blue;
It creates the texture correctly, with one exception. The texture is not of size 1x1. it is the size and shape of the viewport. Which is a problem as it covers up everything else in the application.
In futzing around with the GUITexture after it has been created, I have found that I can change its size (in the inspector) to negative values, it can be resized to about whatever I want, but I feel like i shouldn’t have to provide negative values to set the size of a GUITexture. It SHOULD take on the size of the texture it is given.