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

Question Used By Composite on Tilemap Collider disables Collider.

Discussion in '2D' started by IntrovertGenius, Sep 14, 2023.

  1. IntrovertGenius

    IntrovertGenius

    Joined:
    Dec 13, 2021
    Posts:
    7
    Hello. I am having a little bit of a problem with my character getting stuck on tiles on a tilemap. I have tried multiple solutions like using a capsule or circle collider on the player, but the problem that I am having with that is when I get to the edge of a platform, my character slides off, so I don't like that solution. I have found this solution mentioned a few times on some forums and on Reddit. It says to turn on Used By Composite in the Tilemap Collider 2D, and the Composite Collider 2D will turn the Colliders into one Collider on each of the platforms. I already had a Composite Collider 2D on my platforms because I am using a Platform Effector 2D on the platforms.

    The problem that I am having is when I check off Used By Composite, the Colliders on the Platforms disappear. I have tried both Outlines and Polygons Geometry Type in the Composite Collider 2D, with the same results. One things I am doing is on the tiles in the Sprite Editor I did a Custom Physics Shape, because I was getting stuck on the platforms sometimes when jumping down, which I have to use IgnoreCollider on my player when jumping down to allow my character to jump down, because if I use the effector for that, it will cause my enemies on the platforms to fall through.

    Can anyone tell me why the Collider is disappearing when I enable Used By Composite, but people in the posts that I have seen says it works great for them.

    I appreciate your time. Thank you.

    2023_09_10_215126.png
     
  2. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    10,468
    You've changed the Generation Type from its default of "Synchronous" to "Manual" so that means you need to call the GenerateGeometry from script or hit the button to regenerate its geometry. You've also changed the vertex distance to a large 0.1m (the default is "0.0005").

    If you're ever in doubt, just reset the component to its defaults to check it. You can always undo that.

    The number of shapes produced is shown in the "Info" for any collider BTW.
     
  3. IntrovertGenius

    IntrovertGenius

    Joined:
    Dec 13, 2021
    Posts:
    7
    Worked perfectly, which I expected it would. Thank you so much for your time and detailed response. I really appreciate it.
     
    MelvMay likes this.
  4. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    10,468
    Any time. Glad you're moving forward. :)