Hello Guest

Author Topic: Extra edge colliders generated when committing a tilemap?  (Read 3784 times)

Dorkmaster Flek

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 2
    • View Profile
Extra edge colliders generated when committing a tilemap?
« on: May 26, 2014, 04:31:48 pm »
Hi all, I started messing around with the new 2D features of Unity 4.3 (very impressed with them so far), but I decided to take the plunge into the 2D Toolkit mainly for the atlasing support in Unity Free and most notably the tilemap support.  Quick background: If you've tried to simulate tilemaps with just Unity 2D using vertex snapping or grid alignment and box colliders, you've almost certainly run into the so-called "ghost pixel" problem, where the box collider of your character seems to get stuck on the corners of the blocks.  The 2D Toolkit avoids this issue by automatically generating edge colliders to optimally outline the tiles of the map based on the collider settings in the sprite collection.  This works great and fixes the issue I just mentioned.

The problem I'm having is that whenever I edit the tilemap and commit the changes, it appears to generate a new set of edge colliders on the tilemap data object in the hierarchy in addition to the existing ones.  So after a few edits, I end up with a bunch of extra edge colliders, some of which are no longer accurate depending on what changes I made.  I can go in and manually remove these from the game object, but I would expect that it would remove all the existing ones before generating new colliders each time I commit the tilemap.

Did I perhaps set something up wrong?  This seems to happens in my own little test game, as well as when I was following the tilemap tutorial from the documentation: http://www.2dtoolkit.com/docs/latest/tilemap/tutorial.html

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Extra edge colliders generated when committing a tilemap?
« Reply #1 on: May 27, 2014, 03:01:15 pm »
It should remove existing colliders before adding new ones. This is either a bug, or the tilemap has got into a weird state because of an error. Do you see anything in the console?

Dorkmaster Flek

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Extra edge colliders generated when committing a tilemap?
« Reply #2 on: May 28, 2014, 01:21:23 am »
Hmm, I don't see anything in the console.  But now when I repeatedly commit it, it made a new set of edge colliders the first time, and then seemed to replace them after that.  The original set was still there, but I manually removed that and now it seems to be working fine.  Not sure what was going on before, I'll keep an eye on the console if it happens again.  It seems to have sorted itself out for now.