My trigger does not detect my player.
My Trigger.cs file:

using UnityEngine;

public class Trigger : MonoBehaviour {

public Camera camera1;
public Camera camera2;
public GameObject panel;

 void OnTriggerEnter(Collider other)
    camera1.enabled = false;
    camera2.enabled = true;
    Debug.Log ("Entered-");

 void OnTriggerExit(Collider other)
    camera2.enabled = false;
    camera1.enabled = true;
private void Update()
    if(Input.GetKeyDown(KeyCode.DownArrow) || Input.GetKeyDown(KeyCode.S))


My player components. If I lower the box collider the player gets stuck in the floor.
Where I can start troubleshooting te issue?
Object on which the trigger script is sitting on.
Object on which the trigger script is sitting on.
The solution:
-- I created two colliders, and assigned one as a collider, the other (bigger) is a trigger.
-- I also had problems with the small triggers in the scene. The triggers were to small to be detected by my main player, althought they detected my "sphere" player object

  • \$\begingroup\$ I added the inspector for the object on which the trigger is sitting on. Is it legal to add one BoxCollider which has IsTrigger set to true, and one that has IsTrigger set to false? \$\endgroup\$ – S4NNY1 Jan 15 '18 at 18:52
  • 2
    \$\begingroup\$ Yes. The trigger collider will fire trigger events, while the non-trigger collider will handle physics collisions. Make sure they don't completely overlap though, or the non-trigger collider might prevent objects from ever reaching & tripping the trigger collider inside. \$\endgroup\$ – DMGregory Jan 15 '18 at 18:54
  • \$\begingroup\$ Which camera is your player? Have you set the proper camera to be tagged as player in the inspector? \$\endgroup\$ – Sajomis Jul 23 '19 at 7:33

You have to set IsTrigger to true on the BoxCollider. If this isn't set, it indicated that the box collider is only used for physics.

If you are trying to fire code when two objects collide, you need to use OnCollisionEnter, OnCollisionExit, OnCollisionStay

See the following documentation for more information:



| improve this answer | |
  • \$\begingroup\$ I enabled it, but nothing happened. Also now my object won't now collide with my colliders. I edited my triggers and moved them up, so my player is being detected, but there is no collision with my colliders anymore. \$\endgroup\$ – S4NNY1 Jan 15 '18 at 18:33
  • 1
    \$\begingroup\$ Triggers are for detecting when another collider enters exits or stays inside the volume of the collider that is marked "IsTrigger". It will stop the collider from being used for collisions. See the updated answer momentarily \$\endgroup\$ – Stephan Jan 15 '18 at 18:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.