I have been looking at Richard Hart’s Unity for Flash developers tutorials and got to section 4 on mouse events. I couldn’t get the code to work so I followed the advice of my programming profs and went back to square one.
I started a new scene and added a cube from under the GameObject Create other menu. I created a new javascript and added the following code below the Update function:
function OnMouseEnter(){
Debug.Log(“Mouse Enter”);
}
I saved the script file and then dropped it onto the cube.
Having read the documentation I expected to receive a Mouse Enter message in the console when I moved the mouse over the cube. However, I get nothing.
I checked the Debug.Log line by cutting and pasting it into the Update function and it works fine. I also tried function OnMouseDown and received no feedback either. I checked the cube and it has a box collider and isTrigger is off.
Any idea why this isn’t working. I’m sure it is something simple but I just can’t seem to find it.
BTW I am using the 2.5 demo
Thanks a bunch for the help.