Hi everyone.
Does anyone know how I can change this GetComponent script, so that on MouseOver it changes the material instead of the material.color?
The error is causing my game build to crash, so any help would be great! Thanks
using UnityEngine;
using System.Collections;
public class ChangeColor : MonoBehaviour {
private Color initialColor;
void Start () {
initialColor = GetComponent<Renderer> ().material.color;
}
void OnMouseOver () {
GetComponent<Renderer> ().material.color = Color.red;
}
void OnMouseExit() {
GetComponent<Renderer> ().material.color = initialColor;
}
}