- Home /
Adding script to Gui Texture
I have to gui textures that are arrows, and I want them to become buttons. I just attached the script to the gui texture in the heirarchy, after I run the game, the script is activated whenere I click any place in the screen and not just on the gui texture.. What might be the problem?
Here's the code:
var speed:Number = 10; public var globe:Transform;
function Update () {
if(Input.Get$$anonymous$$ouseButtonDown(0)) globe.Rotate(Vector3.left Time.deltaTime 100 , Space.Self);
}
and I have attached this code to my gui texture in the heirarchy
But where have you defined your "ARROWS" which are GUITexture?
Answer by aldonaletto · May 04, 2012 at 11:24 AM
You should use OnMouseDown - Input.GetMouseButtonDown is reported when the user presses the mouse button, no matter where, while OnMouseDown only occurs when the object (GUIText, GUITexture or collider) is clicked.