Search Unity

  1. Unity 2020.1 has been released.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

EventTriggers with multiple overlapping Collider2D objects

Discussion in '2D' started by vincent-savysoda, Apr 11, 2018.

  1. vincent-savysoda

    vincent-savysoda

    Joined:
    Dec 19, 2016
    Posts:
    45
    I'm having some difficulty getting this to work, and an extensive google search on the topic hasn't revealed a potential solution that doesn't involve a heavy refactor of the current system. Basically my problem here(simplified) is that i have two (or more) separate 2D objects with BoxCollider2D and EventTrigger components attached, but only ONE of these objects responds to player input(both mouse and touch). Changing the hierarchy order or z-position of the objects doesn't make seem to make any difference. I know for a fact that both Colliders are working correctly because as soon as disable one of them, the other one works immediately. Can someone please tell me what I'm doing wrong here?

    Note: I'm using Unity 2017.3.1f1 (updating to latest patches is not possible as they introduced some game-breaking bugs)
     
    Last edited: Apr 11, 2018
  2. vincent-savysoda

    vincent-savysoda

    Joined:
    Dec 19, 2016
    Posts:
    45
    zzz nvm i switched everything to the 3D Collider/raycaster and it works now...

    Kinda dumb that Unity doesn't let the 2D Colliders be sorted the same way as everything else does, via Sorting Layers/Hierarchy/z-order.
     
unityunity