I have a character that i'm trying to resize. I have put the default idle animation sprite right next to the larger sprites in the sprite sheets for consistency. when i put in the larger sprites in the animation window (separate animation from the default, normal size animation), my character is frozen in the air and can't touch the ground. The colliders are edited for the larger sprites, so I know it's not a box collider getting stuck in the ground. I didn't even resize it directly in the animation window (because i tried it and got the same results). Does anybody know what's going on?
2 Answers
I figured it out. I couldn't get it to work the way I was trying and instead did it in script. I knew ahead of time that you can just increase the size of sprite with transform.localScale = new Vector2 (float, float);
but it wasn't working for me because when I did this, my x scale would face in opposite directions due to my Flip code. So I created two new floats called scaleX
and scaleY
and assigned values to them. Then my line of code looked like this,
transform.localScale = new Vector2(transform.localScale * scaleX,
transform.localScale * scaleY);
To anyone who may have the same issue in the future. I was having it with a mount system.

- 16,156
- 19
- 74
- 103

- 115
- 1
- 11
The suggestion from @joe-clark worked for me as well. For me it was happening when animating the left & right, while I tried to resize my player with default sprite set to the idle one.
This was my earlier code:
if (movementX > 0) {
// Face right
transform.localScale = new Vector3(1f, 1f, 1f);
} else if (movementX < 0) {
// Face left
transform.localScale = new Vector3(-1f, 1f, 1f);
}
Here's my modified code, which fixed it:
if (movementX > 0) {
// Face right
transform.localScale = new Vector3(Mathf.Abs(transform.localScale.x), transform.localScale.y, transform.localScale.z);
} else if (movementX < 0) {
// Face left
transform.localScale = new Vector3(-1 * Mathf.Abs(transform.localScale.x), transform.localScale.y, transform.localScale.z);
}

- 393
- 3
- 18