Basically, I have prefabs that I am using as attack sprites, and of course I wanted to add a trigger enabled collider so I can calculate hits… However, as soon as I do this, the center point of the sprites being rendered is thrown off, completely throwing off the desired effect. It seems to be resetting the center of the sprite for some reason, but I’m not sure. How could simply adding a collider have such an effect? Is there something I’m missing? Of course removing the collider restores the behavior I expect, but then I don’t have a simple way to detect collisions… This is a real big wrench being thrown in the works for me, so any ideas are very appreciated!
I discovered the problem. I was making the spawned prefabs as the character’s child; but after removing that line,
primaryAttack.transform.parent = transform;
the strange behavior was no longer there.
EDIT: Sorry, this actually didn’t alter the behavior. I’m still at a loss here. Does anyone else have any other ideas? Again, adding a collider seems to revert the sprite’s center point to it’s default…
EDIT2: OK, it seems that changing the center of the collider is also changing the sprite’s center (set in the sprite editor), so this seems to be where this behavior overlap is coming from. I don’t know what to do but there’s a little more info to ponder… This render behavior change happens with both circle and box colliders btw, so long as their center point vars are altered.