Hello!
I want to make a simple menu script,i watched/read some tutorials, but i don’t understand what is the problem. Here is the code:
using UnityEngine;
using System.Collections;
public class Menu_Exit : MonoBehaviour {
public bool isMenu_Exit = false;
void OnMouseEnter()
{
renderer.material.color = Color.green;
}
void OnMouseExit()
{
renderer.material.color = Color.black;
}
void OnMouseDown()
{
Application.Quit();
}
}
I have a mesh and this. When i start the application, nothing works. No color change, the application doesn’t closes.
I probed to write ‘‘if’’ after the void OnMouseDown(), not works.
Thank you!
Do you have a collider on the gameobject?
– dorpelegYes, i added a box collider. But why i need collider? My mouse only has 2 axes, not 3 ( because this is a 3D menu ) This is problem?
– HydraxiaI know a way to do a menu with 3d text in Unity. Do you want the script?
– EpicGamer928It would be great!
– HydraxiaAre you running this in the inspector? I think Application.Quit() doesn't work when running in the inspector. The onMouse functions don't work on IOS if that's what you are trying. Other then that, it should work.
– dorpeleg