Hi,
I am using raycasting to detect which object has been clicked, however the code I've used detects only manually created game objects such as cubes or spheres. I have a group of sprites created dynamically from prefabs and those remain undetected while clicking on them. It looks like there is no collision detection occurring on those sprites. I've use the following code:
if (Input.GetMouseButtonDown(0)) {
Ray ray = cam.ScreenPointToRay(Input.mousePosition);
RaycastHit hit;
if (Physics.Raycast(ray,out hit,1000))
{
Debug.Log(hit.collider.tag);
}
}
I'm certainly missing something here. I'd appreciate any suggestions.