UPDATE 1: ADDED SCREENCAP FOR ALL COMPONENTS FOR THE BUTTON.
I made a scene thats an start menu for a game, and the buttons i set up wont work. I proofread the code, checked the “interactable” checkbox and looked for any solution, but i didnt find it. The buttons i created:
This one is for the new game, the exit was the same.
Scripts:
NEWGAME:
using UnityEngine;
using System.Collections;
public class NEWGAME : MonoBehaviour
{
// When Hovered Turn Object Red
void OnMouseEnter()
{
GetComponent<Renderer>().material.color = Color.red;
}
// When not hovered turn color back
void OnMouseExit()
{
GetComponent<Renderer>().material.color = Color.white;
}
// If button Start is clicked, level load, else the game will quit
void OnMouseDown(){
Application.LoadLevel("Spawn1");
}
}
EXIT:
using UnityEngine;
using System.Collections;
public class EXIT : MonoBehaviour
{
// When Hovered Turn Object Red
void OnMouseEnter()
{
GetComponent<Renderer>().material.color = Color.red;
}
// When not hovered turn color back
void OnMouseExit()
{
GetComponent<Renderer>().material.color = Color.white;
}
// If button Start is clicked, level load, else the game will quit
void OnMouseDown()
{
Application.Quit();
}
}
Additionally, ive been getting an ugly texture rendering problem, the trees show up black on the background of the fog. I tried setting the billboard higher, but its the same. Heres a capture: