- Home /
OnTriggerEnter Not Working
Okay, I know this is a commonly asked question, but I can't seem to find an answer that covers my scenario. Hopefully I'm just overlooking something really simple.
I have 2 objects: both have a Rigidbody, both have a Box Collider (not trigger), and one has a Box Collider that is a trigger as well (screenshots below). At first I thought maybe having 2 Box Colliders on a single object was the issue, but disabling the non-trigger collider did not result in any improvements.
Both are on the Default layer, and collision settings are fine.
There is also a script attached to the object with the Trigger which is not executing:
void OnTriggerEnter(Collision col)
{
Debug.Log("Trigger Detected");
...
}
Any input is appreciated (as always). Thanks!
Answer by Glurth · Jul 07, 2017 at 02:10 PM
You defined your OnTriggerEnter function incorrectly, it has the wrong signature. https://docs.unity3d.com/ScriptReference/Collider.OnTriggerEnter.html
The parameter should be a Collider
, not a Collision