Gui button for Android issue


I’m fairly new to mobile development. I’m trying to put together a basic walkthrough with a set of simple rollover buttons that loads a diffrent level. When I test out the scene on the android remote it works. When I build and run the app on my device the buttons stop working. Not sure what the issue could be. Has anyone run into this problem?


No Not Really, Usually any button should work, Have you tried this code? You did not specify Java, Or C#, So I have both -


using UnityEngine;
using System.Collections;

public class ButtonTest : MonoBehaviour {
     void OnGUI() {

        if (GUI.Button(new Rect(10, 70, 50, 30), "Test"))
            Debug.Log("Android, Works! IOS, Works! PC, Works!");


function OnGUI() {

    if (GUI.Button(Rect(10,70,50,30),"Click"))
        Debug.Log("Clicked the button with text");


If this dosent work, Ill try some other things. Feel Free to ask questions.

Hi nickkunes,

Thanks for your response. I’m using javascript,forgot to mention that. What you gave me seems to work Thanks! My next question… Does the OnMouseDown funtion still work on Android or would I have to use something else to load my level? I was originally using a GUI texture for my buttons which seam to work on android remote but not when I uploaded as an app.