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

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,722
    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,722