Search Unity

Have trigger detect objects but not be detected itself?

Discussion in 'Editor & General Support' started by roger0, Jun 13, 2021.

  1. roger0

    roger0

    Joined:
    Feb 3, 2012
    Posts:
    1,208
    I have certain situations in my game where I want a trigger to be able to detect other objects, but I don't want other triggers or colliders to be able to detect them. Is there any way to do this?

    Enabling/disabling collision between layers doesn't seem to work because it has to be two way.
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,745
    You could make a reference to the collider(s) you want to ignore and then check in your collision/trigger callback, disregarding appropriately if they match.
     
  3. roger0

    roger0

    Joined:
    Feb 3, 2012
    Posts:
    1,208
    That's how I been doing it. Just seems like a lot of checking for every object that simply needs to ignore it. Wish there was an in house way of making one way triggers.