Search Unity

How to add a collider around a multisided polygon

Discussion in '2D' started by Nichathan, Oct 25, 2020.

  1. Nichathan

    Nichathan

    Joined:
    Mar 8, 2020
    Posts:
    23
    Yeah that's pretty much it, which collider should I use? I included the image that I wanted to toss a collider around so that the player cannot touch it.
     

    Attached Files:

  2. Lo-renzo

    Lo-renzo

    Joined:
    Apr 8, 2018
    Posts:
    1,510
    You likely want a PolygonCollider2D https://docs.unity3d.com/Manual/class-PolygonCollider2D.html
    Then edit it manually.
    If you're using a tilemap, another way would be to use a TilemapCollider plus Composite Collider.
    https://docs.unity3d.com/Manual/class-TilemapCollider2D.html
    https://docs.unity3d.com/Manual/class-CompositeCollider2D.html