- Home /
Self Answered
Scripts don't work when i try app
I am doing an application for android. When i start the game on Unity, or i try play on it all script and icons are working, but when i build my app and try it on my phone 2 botton don't work (the button for exit game and the button for return to main menu). Help me please
N.B the button for return to main menu is in 2 scenes, in one is working, in the other no.
That are the scripts Quit:
 using UnityEngine;
 using System.Collections;
 
 public class Quit : MonoBehaviour {
     
     // Use this for initialization
     void Start () {
         
     }
     
     // Update is called once per frame
     void Update () {
         
     }
     void OnMouseDown() {
         Application.Quit();
     }
 }
Main menù
 using UnityEngine;
 using System.Collections;
 
 public class MainMenu : MonoBehaviour {
 
 
     // Use this for initialization
     void Start () {
     
     }
     
     // Update is called once per frame
     void Update () {
     
     }
     void OnMouseDown() {
         if (GameObject.Find("?")!=null){
             GameObject.Find("?").audio.Stop();}
         Application.LoadLevel(0);
 
     }
 }
 
Answer by niall1111 · Aug 13, 2014 at 01:14 PM
OnMouseDown functions don't work on iOS or Android. You need to use the Input class, see here: http://answers.unity3d.com/questions/47753/simple-touch-of-a-3d-object-in-ios.html
Answer by RobotReebot · Aug 13, 2014 at 01:41 PM
I re-do the icon and now all work, I don't change script
Follow this Question
Related Questions
Unity Touch=2 commends? 1 Answer
Touch returns twice on Android 1 Answer
Problem with Input.touchCount == 1 1 Answer
Shader shows black lines from occluded object 1 Answer
Create on Gui controls for Mobile Devices (Android) 1 Answer
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                