Search Unity

Ignore tilemap collider

Discussion in 'Scripting' started by NORWAYY, Apr 9, 2021.

  1. NORWAYY

    NORWAYY

    Joined:
    Nov 10, 2020
    Posts:
    17
    Is there any way to ignore a tilemap collider or a specific collider in
    Code (CSharp):
    1. Physics2D.OverlapBox
    but use it in
    Code (CSharp):
    1. void OnMouseEnter()
     
  2. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    7,912
    Yes, OverlapBox accepts a LayerMask parameter which allows you to selectively include/exclude certain layers.
     
  3. NORWAYY

    NORWAYY

    Joined:
    Nov 10, 2020
    Posts:
    17
    And how do I do that?
     
  4. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    7,912