- Home /
 
               Question by 
               Kye923 · May 17, 2015 at 07:12 PM · 
                objectmouseontriggerenterclickonmousedown  
              
 
              How to make object clickable when user enter collider ?
Hi, I'm new to Unity.
May I know how can I make an object is clickable for showing text when user enter the collider?
I used OnMouseDown() but the object will show the text even I'm outside of the collider.
Below are some of my coding. May I know how I can correct it ? Thanks.
 void OnMouseDown() {entrance = true;}
 void OnTriggerEnter (Collider col)
 {
         if (col.gameObject.tag == "Player")    {
             entrance = true;
     }    
 }
     void OnTriggerExit (Collider col)
     {
         if (col.gameObject.tag == "Player")
         {
             entrance = false;
         }
     }
     
               Comment
              
 
               
              Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                