xxxxxxxxxx
private void OnTriggerEnter(Collider other)
{
//Do something
}
xxxxxxxxxx
// When other object enter the trigger zone
private void OnTriggerEnter(Collider other){
// Do what you want
// Example, if you want to check object "object1" enter the trigger zone
if(other.gameObject.name == "object1"){
// Do what you want
}
}
// When other object stay in the trigger zone
private void OnTriggerStay(Collider other){
// Do what you want
// Example, if you want to check the object "object1" stay in the trigger zone
if(other.gameObject.name == "object1"){
// Do what you want
}
}
// When other object exit the trigger zone
private void OnTriggerExit(Collider other){
// Do what you want
// Example, if you want to check the object "object1" exit the trigger zone
if(other.gameObject.name == "object1"){
// Do what you want
}
}