How do I raycast from a UI object? I have tried
Ray ray; Camera cam; Transform obj; //UI object ray = cam.ViewportPointToRay(obj.position);
ray = new Ray(obj.position, obj.forward);
Neither of these seem to work.
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It only takes a minute to sign up.Sign up to join this community