Get GameObject on OnMouseOver using photon

Options
I am trying something like this but is not working

public void OnMouseOver()
{
if (Input.GetMouseButtonDown(0))
{
Debug.Log("click");
Debug.Log(PhotonNetwork.player.ID);
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit hit;

if (Physics.Raycast(ray, out hit, 100))
{
Debug.Log(hit.transform.gameObject.name);
}

}
}

I think its because I have to use playerCamera.GetComponent().ScreenToWorldPoint(mousePos); but I am not totally sure.

Comments