I'm making a scene where when you hover over the top corner, the tray slides into the scene, then slides out when you move the mouse off of the tray. I have that working smoothly with:
function OnMouseOver ()
{
while (transform.position.x > 4.0)
{
transform.position = transform.position - new Vector3 (0.1, 0, 0);
yield WaitForSeconds (0.1);
}
}
function OnMouseExit ()
{
while (transform.position.x < 12.0)
{
transform.position = transform.position + new Vector3 (0.1, 0, 0);
yield WaitForSeconds(0.0001);
}
}
However, I plan on adding other clickable objects on top of the tray, and when I hover over those objects, it counts as an "OnMouseExit" and closes the tray. What's the best way to avoid this but keep the objects clickable?