- Home /
Trigger is not working
I have 2 objects, both with box colliders, 1 of them the isTrigger box is checked, but nothing happens.
private void OnTriggerExit(Collider other) {
Debug.Log("Building is triggering...");
Destroy(other.gameObject); }
Answer by HernandoNJ · May 01, 2020 at 09:47 PM
I found out the reason. One of the objects should have a rigidbody attached to it for detecting the collision. Anyway, I still wonder if it is possible without rigidbody.
https://docs.unity3d.com/Manual/CollidersOverview.html
Triggers:
The scripting system can detect when collisions occur and initiate actions using the OnCollisionEnter function. However, you can also use the physics engine simply to detect when one collider enters the space of another without creating a collision.
A collider configured as a Trigger (using the Is Trigger property) does not behave as a solid object and will simply allow other colliders to pass through. When a collider enters its space, a trigger will call the OnTriggerEnter function on the trigger object’s scripts .
Your answer
![](https://koobas.hobune.stream/wayback/20220612233028im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Turning off trigger with multiple box colliders? 0 Answers
Help with OnTriggerEnter issue 3 Answers
How to control another script's isTrigger 3 Answers
Make object stay on the Terrain, while the isTrigger is checked 0 Answers
How to make a collider be is trigger to some certain layers but be normal to others? 2 Answers