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.

Question ColliderCast vs Trigger

Discussion in 'Physics for ECS' started by Orimay, Aug 28, 2020.

  1. Orimay

    Orimay

    Joined:
    Nov 16, 2012
    Posts:
    304
    I have portals and wanna know if someone stepped into. Would it be more performant to use triggers and just loop over all the in-game triggers and cherry-pick the portal ones, or should I use zero-distance ColliderCast per portal?
     
  2. petarmHavok

    petarmHavok

    Joined:
    Nov 20, 2018
    Posts:
    461
    I'd go for trigger, implement ITriggerEventsJob and filter out those you are not interested in early. Also, with latest samples code, you can look at DynamicBufferTriggerEventAuthoring, which gives you two things - trigger events on an entity you are interested in (so you don't need to filter it), as well as stateful events with Enter/Stay/Exit info.
     
    Orimay likes this.
  3. Orimay

    Orimay

    Joined:
    Nov 16, 2012
    Posts:
    304
    Thank you very much!
     
    petarmHavok likes this.