Common Issues: Colliders and Triggers
Common collider issues
Issue:
OnTriggerEnter(), OnTriggerStay(), and/or OnTriggerExit() are not working.
Solutions:
Make sure the objects have colliders and the proper one has the checkbox for Trigger checked in the Inspector Tab. This can be checked and updated with the script by using .isTrigger with the object's collider component.
Try adding a Rigidbody component to objects that need them.
Issue:
OnColliderEnter(), OnColliderStay(), and/or OnColliderExit() are not working.
Solutions:
Make sure the objects have colliders and the Trigger property is unchecked in the Inspector Tab. This can be checked and updated with the script by using .isTrigger with the object's collider component.
Try adding a Rigidbody component to objects that need them.
You can check for and update these components and their properties within the script. Go here for information about accessing components through the script.
Last updated