GUI.Label if close to object
Hello All im trying to get a script im working on to work. now what this script does is; when a player gets a certain distance to an object GUI.lable will print "getting close" but with the vector3.Destance in c# it is kinda confusing. here is what i have. if player is at a certain distance the GUI will print.
 using UnityEngine;
 using System.Collections;
 
 public class azuna1 : MonoBehaviour {
 
 
     public bool toggleGUI = false;
 
     
     
     
     void Start() { 
         toggleGUI = false;
     }
     
     void IsClose(){
         return Vector3.Distance (gameObject.transform.position,
                                  player.transform.position)<5;
     }
     
     void OnGUI () {
         if (toggleGUI == true)
             GUI.Label (Rect (95,25,1550,1550), "getting close");
     }
 }
its a similar use to triggerEnter and Exit with out the colliders is what im going for.
               Comment
              
 
               
              Your answer
 
 
             Follow this Question
Related Questions
How to set a Text on a GameObject? 1 Answer
How to use individual textures as font in GUI? 0 Answers
Text disappear on OnTriggerExit() 1 Answer
Gui Text won't turn off 0 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                