I guess it’s kinda stupid monkey’s code, but i’m newbee here, and wrote this using pieces of other codes. Why it doesn’t work?
using UnityEngine;
using System.Collections;
public class Menu : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
OnMouseEnter ();
OnMouseExit ();
}
void OnMouseEnter() {
GetComponent<Renderer>().material.color = Color.red;
}
void OnMouseExit() {
GetComponent<Renderer>().material.color = Color.white;
}
}