Hello Guest

Author Topic: Problem with tk2d custom box colliders not working  (Read 4811 times)

2dddd

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 4
    • View Profile
Problem with tk2d custom box colliders not working
« on: July 18, 2014, 07:03:26 pm »
I ran into what seems to be a tk2d bug, but I found a way to fix it in my case. I was using custom box colliders on some of my sprites in one of my tk2d sprite collections. The colliders were working fine when the game was running, but later I adjusted some colliders in that same sprite collection on some different sprites, and then all of a sudden the box colliders on my aforementioned sprites suddenly would not work anymore during runtime.

After trying all kinds of things, I found a way to fix the problem: Select the game object in the Hierarchy, and then in the Inspector change its sprite to a different sprite and then switch it back to the original sprite. After I did this for each of my faulty sprites, then they worked perfectly once again. So if someone has a tk2d sprite with a custom box collider that suddenly will not work correctly during runtime, then try switching the sprites in the Inspector and see if that fixes the problem. I hope this helps anyone who runs into this problem.
« Last Edit: July 18, 2014, 10:23:37 pm by 2dddd »

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Problem with tk2d custom box colliders not working
« Reply #1 on: July 19, 2014, 04:33:29 pm »
Thanks for reporting that. It doesn't sound like a tk2d bug as much as unity physics getting screwed up somehow - if the collider exists, I would place my suspicions on that. If you can get a repro case where this is broken, please post it, I'd like to confirm one way or the other.

Sickwitit

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Problem with tk2d custom box colliders not working
« Reply #2 on: August 27, 2015, 07:37:35 pm »
I've actually had this same issue. The reason is this. Once you change sprites, the box collider does not update along with the new sprite selection dimensions.

1. Select the correct sprite
2. Remove the box collider
3. Add new box collider

Now the box collider is updated to the new sprites dimensions.