Question by 
               elmaurirestrepo · Oct 26, 2016 at 04:39 PM · 
                triggertextgetcomponenttimer  
              
 
              I need some help Stopping a timer when the player touches a trigger. I've got two scripts. One for Timer and other for the trigger.
Hi guys. Please I need some help here. I have a countdown timer working perfectly. Is linked to a canvas text. I would like to stop it when my player touches a trigger. I am new at unity and I have been trying to sort it out by using GetComponent, but nothing happens. Please help!
TIMER 
TRIGGER 
 
                 
                temporizador.png 
                (31.9 kB) 
               
 
                
                 
                trigger.png 
                (38.0 kB) 
               
 
              
               Comment
              
 
               
              Answer by oStaiko · Oct 26, 2016 at 05:38 PM
Instead of:
 GetComponent<temporizador>();
 
               Use:
 gameObject.GetComponent<temporizador>();
 
               And to stop timer:
 gameObject.GetComponent<temporizador>().myCooltimerEstaActivo = false;
 
              Answer by elmaurirestrepo · Oct 26, 2016 at 06:27 PM
Many thanks, however I need to display the time when the player hit the trigger to win the game that is why I need to print that time on the trigger script.

 
                 
                laberintoexplicado.png 
                (497.6 kB) 
               
 
              If you need to print the time, just put the code inside of the "if (other.tag == "player")" part of the trigger. Is there something else giving you problems?
Your answer