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. Dismiss Notice

Question Can I Use Both LayerMask and Depth on ContactFilter2D?

Discussion in '2D' started by timothyeggers, Jun 3, 2021.

  1. timothyeggers

    timothyeggers

    Joined:
    Jan 28, 2018
    Posts:
    5
    I'm going to have overlapping enemies in this 2D game, and as such would like to prioritize both z index and layermask. Is this possible?
     
  2. timothyeggers

    timothyeggers

    Joined:
    Jan 28, 2018
    Posts:
    5
  3. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    10,533
    > Can I Use Both LayerMask and Depth on ContactFilter2D?
    Yes, of course but a quick test would show you that too.

    No idea what you mean by "prioritize" but any priority in doing any action would be up to you. The ContactFilter2D doesn't control result sorting, each query performs its own sorting.
     
    timothyeggers likes this.