Advertisement
Guest User

Untitled

a guest
Dec 30th, 2015
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class rayHoward : MonoBehaviour {
  5. public bool rayHit = false;
  6. RaycastHit hitInfo;
  7.  
  8. void OnGUI()
  9. {
  10. if (rayHit)
  11. {
  12. GUI.Label (new Rect (10, 10, 100, 10), RaycastHit.GetComponent<Text>);
  13. Debug.Log ("Got Here");
  14. }
  15. }
  16.  
  17. void Update ()
  18. {
  19. if (Input.GetMouseButtonDown(0))
  20. {
  21. Ray rayOrigin = Camera.main.ScreenPointToRay(Input.mousePosition);
  22.  
  23. if(Physics.Raycast(rayOrigin, out hitInfo, 3f))
  24. {
  25. rayHit = true;
  26. }
  27. }
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement