title: How to detect mouse click on GUITexture in unity
body: <p>I am trying to add controls through mouse in place of keyboard in the game.
  I added 4 movement keys and 1 fire button through the GUI texture in unity.
  In the game there is already a player controller which controls the player through keyboard strokes</p>
  
  <p>I didnt get, how to make the player move if the direction button (GUITexture) is clicked</p>
  
  <p>Button Script</p>
  
  <p>using UnityEngine;
  using System.Collections;</p>
  
  <p>public class RightButton : MonoBehaviour {</p>
  
  <pre><code>public Texture2D bgTexture;
  public Texture2D airBarTexture;
  public int iconWidth = 32;
  public Vector2 airOffset = new Vector2(10, 10);
  
  
  void start(){
      }
  
  void OnGUI(){
      int percent = 100;
  
      DrawMeter (airOffset.x, airOffset.y, airBarTexture, bgTexture, percent);
  }
  
  void DrawMeter(float x, float y, Texture2D texture, Texture2D background, float percent){
      var bgW = background.width;
      var bgH = background.height;
  
      GUI.DrawTexture (new Rect (x, y, bgW, bgH), background);
  
      var nW = ((bgW - iconWidth) * percent) + iconWidth;
  
      GUI.BeginGroup (new Rect (x, y, nW, bgH));
      GUI.DrawTexture (new Rect (0, 0, bgW, bgH), texture);
      GUI.EndGroup ();
  
  
  }
  </code></pre>
  
  <p>}</p>
  
  <p>I am unable to add the GUI Button in place of GUI.DrawTexture, its giving invalid argument error
  and so i am unable to add how to check the button is clicked or not</p>
  
  <p>Thanks</p>