Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

Strange behavior with on trigger enter when enabling and disabling colliders.

Discussion in 'Physics' started by thundershield, Mar 6, 2021.

  1. thundershield

    thundershield

    Joined:
    Dec 18, 2017
    Posts:
    2
    Hello, I'm trying to implement a combat system where I briefly enable a boxcollider2d and have on trigger enter fire for it to detect what it has hit. However, it has not been behaving as it should. When I manually enable and disable the collider, or the game object it is attached to, it will trigger once for every collider it intersects and will trigger with every re-enable. When activated by a script, though, it will only trigger off of one collider it is colliding with. In addition, it will then refuse to respond to any of those colliders until it is reenabled not touching them or if the character is attempting to move. I initially thought thse issues were due to using the animation record system to enable and disable the colliders, but I have now set them up in code as well and they are still showing this behaviour? Does anyone know what could be causing this or a pointer and where I could go to find out? I've done a lot of research up to this point but I don't think I know what I need to look up to get my answers.
     
  2. unity_1BE8A665954FB3795393

    unity_1BE8A665954FB3795393

    Joined:
    Dec 3, 2022
    Posts:
    1
    Hello, have u fixed up? I'm getting the same problem
     
  3. R3t4rd0

    R3t4rd0

    Joined:
    Jun 11, 2022
    Posts:
    3
    Had a similar problem

    and i was able to fix it by disabling the is trigger entirely on the collider.
    Hope that helped