using UnityEngine;
using System.Collections;
public class Button : MonoBehaviour {
public TextMesh textmesh;
public Material normally;
public Material onMouseHover;
public AudioClip hover_sound;
public bool quit = false;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
RaycastHit HitInfo;
bool played_sound = false;
if(Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition) , out HitInfo))
{
textmesh.color = Color.gray;
if(!played_sound)
{
played_sound = true;
audio.Play();
}
}else{
textmesh.color = Color.white;
played_sound = false;
}
}
void onMouseEnter() {
Debug.Log("Works!");
}
void onMouseDown()
{
if(quit)
{
Application.Quit ();
}
}
}
Hi
I am fairly new to unity. Soo i am trying to create a 3d menu and i have this script that changes the color whenever mouse hovers over one of the buttons. The problem is when one of the buttons gets triggered all of them change color.
Thanks for the replies:)