Advertisement
Guest User

Untitled

a guest
Aug 25th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. if(Input.GetMouseButton(0))
  2. {
  3. PointerEventData pointer = new PointerEventData(EventSystem.current);
  4. pointer.position = Input.mousePosition;
  5.  
  6. List<RaycastResult> raycastResults = new List<RaycastResult>();
  7. EventSystem.current.RaycastAll(pointer, raycastResults);
  8.  
  9. if(raycastResults.Count > 0)
  10. {
  11. foreach(var go in raycastResults)
  12. {
  13. Debug.Log(go.gameObject.name,go.gameObject);
  14. }
  15. }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement