how do i use GUI buttons with a android device(tablet)

I no how to use normal GUI but it apparently doesn’t work the same way with the tablet. So all I need to know is how to use gui for android(tablet) and stuff.

here is what im doing in normal GUI

function OnGUI()
{
	 if (GUI.Button (Rect (100,50,50,20), ">"))
	 {
	 	transform.Translate(1,0,0);
	 }
	 
	 if (GUI.Button (Rect (0,50,50,20), "<"))
	 {
	 	transform.Translate(-1,0,0);
	 }
	 
}

if(GUI.Button works on Android, But i think i know what your issue is.

you need to use this.

    function OnGUI()
    {
    if (GUI.RepeatButton (Rect (100,50,50,20), ">"))
    {
    transform.Translate(1,0,0);
    }
     
    if (GUI.RepeatButton (Rect (0,50,50,20), "<"))
    {
    transform.Translate(-1,0,0);
    }
     
    }

I Guess your making a platformer or something similar and you want the item to move when your holding the button, So GUI.RepeatButton does just that. Hopefully this is what you are after :slight_smile:

i found how to do it. All you have to do is put this on a gui texture. It only selects the gui texture that it is on tho.

using UnityEngine;
using System.Collections;
 
public class Test : MonoBehaviour
{
   void OnMouseDown()
    	{
    	   
    		Debug.Log("The mouse is down on " + this.name);	
    		Owner.SendMessage(Type);
    	}
    }