I have very basic 2D android platform project. There’s a script GameController attached to a camera (I have only one camera). The code of the GameController here:
void Update () {
if (Input.GetMouseButtonDown(0)) {
Debug.Log( "LMB click!" );
Ray ray = Camera.main.ScreenPointToRay( Input.mousePosition );
RaycastHit2D hit = Physics2D.GetRayIntersection( ray, 1000 );
if ( hit ) { Debug.Log( "Hit!" ); }
}
}
There are some cubes with Box Colliders and cubes with RigidBody2d. So in Debug window I see only “LMB click!” and nothing more! Why I don’t see the “Hit!” message?