Search Unity

Multiple paths in EdgeCollider2D

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

  1. TFlippy

    TFlippy

    Joined:
    Nov 12, 2014
    Posts:
    27
    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:
    11,473
    Just use multiple EdgeCollider2D components on the same GameObject.
     
  3. TFlippy

    TFlippy

    Joined:
    Nov 12, 2014
    Posts:
    27
    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:
    11,473
    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:
    27
    Oops, nevermind. I just realized that this was added by me.