Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Multiple paths in EdgeCollider2D

Discussion in '2D' started by TFlippy, Jul 11, 2017.

  1. TFlippy

    TFlippy

    Joined:
    Nov 12, 2014
    Posts:
    23
    Is it possible to have multiple separate paths in EdgeCollider2D that aren't connected without making extra GameObjects, similiar to PolygonCollider2D?
     
  2. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    2,019
    Just use multiple EdgeCollider2D components on the same GameObject.
     
  3. TFlippy

    TFlippy

    Joined:
    Nov 12, 2014
    Posts:
    23
    I can't add multiple components of same type to the GameObject with AddComponent - "Already contains a component".
     
  4. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    2,019
    You certainly can add as many Circle, Edge, Box, Polygon and Capsule colliders as you like to a GameObject. Only CompositeCollider2D restricts to a single one.
     
  5. TFlippy

    TFlippy

    Joined:
    Nov 12, 2014
    Posts:
    23
    Oops, nevermind. I just realized that this was added by me.