- Home /
Question by
UnityDevelopper · May 31, 2014 at 08:37 PM ·
mouseevent
Mouse Event Not Working in Unity 4.5
Here one of the script i used with al 3 mouse events, but the event don't work
using UnityEngine;
using System.Collections;
public class MoveOnText : MonoBehaviour {
public int Lvl;
public Color HoverColor;
public Color ClickColor;
public TextMesh mesh;
// Use this for initialization
void Start () {
mesh = gameObject.GetComponent<TextMesh> ();
}
// Update is called once per frame
void Update () {
}
void OnMouseEnter(){
mesh.color = HoverColor;
}
void OnMouseDown(){
Debug.Log ("Mouse is clicked");
mesh.color = ClickColor;
Application.LoadLevel(Lvl);
}
void OnMouseExit(){
mesh.color = Color.white;
}
}
if something wrong with the script tell me I did an experiment and this is what i got the textmesh with collider non are working the textmesh with 2d collider non are working the textmesh with no colliders non are working incase this is a factor of a mouse events,the textmesh is a child of an object(this started happening after unity 4.5).
Comment