I’m new to Unity and I am trying to use OnMouseDown() to register a click on a cube object. Basically, my code looks like
function OnMouseDown(){
Debug.Log("Clicked");
}
This is the entire javascript file. There are no includes, no variables, and no other functions in it.
My scene consists only of a single cube with this script attached to it. I run the scene, but nothing happens when I click on the cube in either the game view or the scene view.
The cube is in the default layer and has a box collider. I have changed nothing about the project or scene apart from adding the cube.
I have been to several other questions but none of them seem to have the answer I am looking for. At this point, the only thing I can think of is that I forgot to include something when I created the project. Any thoughts?