Hi, i try to drop objects from ui into 2d world using raycasting. Object is dropped on the good layer but in a wrong place. Dropped item always shows up on coordinates x=0, y=0, z=0 insted of mouse position in world. i know something is wrong, propbably RaycastHit is not defined but im not sure how to fix this and would apreciate some help
public Camera cam;
public virtual void OnDrop()
{
RaycastHit hit = new RaycastHit();
Ray ray = cam.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast(ray, out hit, 0))
{
gameObject.SetActive(true);
gameObject.transform.position = hit.point;
}
}