Raycast just does not see model I added.

I am not sure what I was doing wrong, in an update of my controller script I put this chunk of code:

if(Input.GetMouseButtonDown(0))
	{	
		var ray : Ray = Camera.main.ScreenPointToRay(Input.mousePosition);
		var hit : RaycastHit;
		
		if(Physics.Raycast(ray, hit, 100)) 
		{
				
			Debug.Log(hit.transform.gameObject.name);
		}
	
	}

It works, sees the background plane, the player sphere, pieces of the level etc. So I wanted to really pick “bad guys” out…so i added a dummy model I found on the asset store here:

Downloaded/imported the model into my scene, dropped 3 into my hierarchy…and yet I can click all day and the above code only sees the background plane never sees this model. So failing to see what I am missing?

The model has a collider on it?

Oh! Actually what’s more likely is this. It’s going to report the LAST object that the ray hits. So it’s probably passing through the enemy model and then hitting the background plane and reporting that.

EDIT: do Physics.RaycastAll and iterate through the results.

Silly me, you are right with the collider. I am not sure how these models work I guess from the asset store, but it had no collider … just a mesh renderer and transform. So I added a mesh collider that fit the mesh itself (I think a box collider would be better even)…one that is just used for “Clicking” …think so? either case I think I can get it going… just not sure what the best practices are.