- Home /
OnMouseUp not working in build?
In my game I made a menu with some signs (like Options, Levels, etc), I wrote a script that lets you click on a sign and, for example, load a level using OnMouseUp.
The script is working for all of the signs in the Editor, but for the Build of the game 1 sign is not working, every time I click on it nothing happens. What kind of weird bug is this? A little part of the code:
using UnityEngine;
using System.Collections;
public class TextControl : MonoBehaviour {
public int text = 0;
public AudioClip clickSound;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void OnMouseEnter(){
renderer.material.color = Color.red;
}
void OnMouseExit(){
renderer.material.color = Color.white;
}
void OnMouseUp(){
audio.PlayOneShot(clickSound);
if(text == 0){
Application.LoadLevel(2);
}
.
. //here are the others (1,2,3,4,5,6,7 etc)
.
if(text == 14){ //this is the one that's not working in the Build
Application.LoadLevel(3);
}
}
}
The Object has a BoxCollider and it turns red when I put the mouse on it, so that's not the problem. In the Editor the Level 3 is loading, but in the Built game nothing happens whenever i click the sign to load that Level.
Your answer
![](https://koobas.hobune.stream/wayback/20220613132242im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
Game Works on Computer, but not on iPhone 0 Answers
Main Menu scrpit not working 1 Answer
Fog not rendering in Unity 5 0 Answers
Unity 3d android not working 1 Answer