Hi everyone, I have a problem of combining locked cursor with OnMouseEnter/Exit/Down. It kinda works in the Unity game screen, but after I build the actual game, it ignores mouse input. Maybe it would work better with raycasting but so far I tried to avoid it to keep everything simple.
The script for CursorLock in cs:
void Start ()
{
Cursor.lockState = CursorLockMode.Locked;
Cursor.visible = (false);
}
void Update ()
{
Cursor.lockState = CursorLockMode.Locked;
Cursor.visible = (false);
}
}
(I tried this one as well: Unity - Scripting API: Cursor.lockState)
The script that I added to objects that should be highlighted. It’s in js.
var isStartButton = false;
var isExitButton = false;
function OnMouseEnter()
{
GetComponent.<Renderer>().material.color = Color.gray;
}
function OnMouseExit()
{
GetComponent.<Renderer>().material.color = Color.black;
}
function Update()
{
if (Input.GetKey(KeyCode.Escape))
{
Application.LoadLevel (0);
}
}
function OnMouseUp()
{