Error when trying to make script for main menu.
So i got a script of the internet for a simple main menu with a "Play" button and a "Quit" button. My problem is that when i try to put the script on the "Play" button it gives me the following error: Assets/Main_Menu.js(6,9): BCE0144: 'UnityEngine.Component.renderer' is obsolete. Property renderer has been deprecated. Use GetComponent() instead. (UnityUpgradable)
I'm new to Unity and scripting so maybe its easy to fix but i don't know how. This is the script btw (javascript) :
var quit=false;
function OnMouseEnter() {
renderer.material.color = Color.red; //Change Color to red!
}
function OnMouseExit() {
renderer.material.color = Color.white; //Change Color to white!
}
function OnMouseUp() {
if (quit == true)
{
Application.Quit(); //If you click on quit aplication quits.
}
else
{
Application.LoadLevel(1); //If you click on other button it loads game!
}
}
function Update() { if (Input.GetKey(KeyCode.Escape)) //If you press (escape) game force closes! { Application.Quit(); }
}
Your answer
Follow this Question
Related Questions
Jump Script not Working JavaScript 1 Answer
Destroy an INDIVIDUAL instantiated object 0 Answers
Helppp mee script unity 5 1 Answer
Any way to use UI on a screen renderer? 0 Answers