Question by 
               floatingland · Jan 22, 2016 at 04:39 PM · 
                c#ontriggerenter  
              
 
              How to disable OnTriggerEnter on one script?
I use GetComponent <ScriptName>().enabled=false
but the OnTriggerEnter function of the script is still called,when collision happens.
How could I disable OnTriggerEnter of one script,because i need to user another script to handle the collision?(c#)
               Comment
              
 
               
              Answer by ShadyProductions · Jan 22, 2016 at 08:10 PM
You could add a boolean in that script and check in the trigger if it is true or false. For example:
 public bool isAllowedToTrigger;
 
 void OnTriggerEnter() {
 if (isAllowedToTrigger) {
 //do everything in here
 }
 }
This way you can just do GetComponent <ScriptName>().isAllowedToTrigger = false 
 And it won't do anything when its false. 
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                