Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class rayHoward : MonoBehaviour {
- public bool rayHit = false;
- RaycastHit hitInfo;
- void OnGUI()
- {
- if (rayHit)
- {
- GUI.Label (new Rect (10, 10, 100, 10), RaycastHit.GetComponent<Text>);
- Debug.Log ("Got Here");
- }
- }
- void Update ()
- {
- if (Input.GetMouseButtonDown(0))
- {
- Ray rayOrigin = Camera.main.ScreenPointToRay(Input.mousePosition);
- if(Physics.Raycast(rayOrigin, out hitInfo, 3f))
- {
- rayHit = true;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement