Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct here to familiarize yourself with the rules and how to post constructively.

  2. Unity 2022.1 is now available as the latest Tech release.
    Dismiss Notice

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,201
    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:
    24,619
    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,201
    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.
     
unityunity