hey everybody ,
I am trying to add a GUITexture as a component on an empty game object by script like this
public GameObject crossHair;
public Texture2D crossHairImage;
// Use this for initialization
void Start ()
{
Screen.lockCursor=true; // hide it and lock it so u can't hit any thing
Screen.showCursor=false; // Hide the cursor but it will be exist and i can press on anu GUI
crossHair.AddComponent<GUITexture>();
crossHair.guiTexture.pixelInset=new Rect(-200,100,46,46);
crossHair.guiTexture.texture=crossHairImage;
}
I added the empty game object and the texture in unity editor
but when the is running nothing appears on the screen ,
Note : I clicked on the empty game object while the game is running and the GUITextures was assigned to it.
any help please