Touch on GUI Text (Mobile)

Hi,

I’m new in this forum, so support me :smile:, and sorry for newbie question…

i want to ask, how to make GUI Text is touchable when its being click. i’m using unity 3.0 for iphone. i know i can do GUI.Button, but i want GUI Text to do the same.

i try this code, but dunno how to implement proceed

 var hit : RaycastHit;
     var ray = Camera.main.ScreenPointToRay (Input.mousePosition);
     for(touch in Input.touches) {
     	
      //how to code in here, when i want only that GUI Text is clicked to do something.

     }

Thx

Hi, welcome to the forum!

A script on the GUIText object will get sent the OnMouseDown message when the mouse is clicked on the text:-

function OnMouseDown() {
  // Respond to click.
}