GUITexture isn't visible ,,, added by script

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

Check the position of the gameObject you are assigning the GUITexture to. Its position should be between 0 and 1. This can be a bit harder to check if it is a child of another object. The problem is probably that the GUITexture is not on the screen.

When possible, it is better to have gameObjects set up already in the scene before starting. It helps with memory management.