2D Toolkit Forum
2D Toolkit => Support => Topic started by: Rybar on October 26, 2012, 02:13:16 am
-
I'm trying to use sliced sprites as platforms, so I can use 1 simple box image for several different sized platforms, however I'm running into a problem with the box collider snapping back to a size thats much smaller than the committed dimensions for the sliced sprite.
Maybe they're only supposed to be used for UI/buttons? Thanks for your help in advance.
-
No that should work properly. What is the collider set up on the sprite like?
-
Hello, I've had the same problem I think, I have a sliced sprite with a User Defined collider, but whenever I instantiate the prefab the collision of the sprite gets reset to something very small.
I'm using version 1.8 final 2, looking in tk2dSlicedSprite.cs:388 it seems like UpdateCollision() doesn't take into account what kind of colliderType is set, as a temporary fix I changed it like this:
new void UpdateCollider()
{
var sprite = collectionInst.spriteDefinitions[_spriteId];
if (boxCollider && sprite.colliderType == tk2dSpriteDefinition.ColliderType.Box)
{
boxCollider.center = boundsCenter;
boxCollider.extents = boundsExtents;
}
}
This seems to have solved the problem for me, for now...