File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change 1+ //Inbora studio (clam all copyrights)2020-22 All scripts are code by Inbora Studio.
2+ //Devloped By Alok Khokhar for more information follow as on instagram @inbora.studio or ower webside.
3+ //https://inborastudio.wixsite.com/inborastudio
4+
5+ using UnityEngine ;
6+ using UnityEngine . UI ;
7+
8+ public class RaycastDetection : MonoBehaviour
9+ {
10+ Ray ray ;
11+ RaycastHit raycastHit ;
12+ Text textUI ;
13+
14+ void Awake ( )
15+ {
16+ textUI = GameObject . FindObjectOfType < Text > ( ) ;
17+ }
18+
19+ void Update ( )
20+ {
21+ ray = new Ray ( transform . position , transform . forward ) ;
22+ if ( Physics . Raycast ( ray , out raycastHit ) )
23+ {
24+ textUI . text = raycastHit . collider . gameObject . name ;
25+ }
26+ else
27+ {
28+ textUI . text = "" ;
29+ }
30+ }
31+ }
You can’t perform that action at this time.
0 commit comments