Resizing Sprites
Okay, I'm relatively new to unity and I'm trying to create a basic 2D jump and run game, but I encountered a little problem, that I don't understand.
If I resize my sprites in the scence view by simply stretching them per mouse, their size change on the scene view as expected, but the inspector values don't.
So for example if I resize my ground sprite, the Box Collider still has the same values as before. This leads to some positioning probelms for me, as I try to position things accordingly to their size shown in the inspector.
Would be cool if somebody could explain this behaviour to me :)
Answer by ronanskie · May 01, 2017 at 01:59 PM
You should use the scale values in the transform component of the sprite instead of stretching the size per mouse. If you change the scale values of the sprite, the size of the box collider should just increase or decrease with it. This at least works with 3d games, I'm not completely sure if it's the same for 2d games. You can also change the box colliders size manually in the box collider component without changing the size of the sprite.
mhh strange, tried it with the scale values but the box collider however still keeps the same values
this is indeed strange. I just tried the same in 2D and the box colliders size changes with the scale values of the sprite just like in 3D. Which version of unity are you using? It might depend on that.
Your answer
Follow this Question
Related Questions
Getting an object two move between two objects continuously 1 Answer
Select only one Layer in the inspector,Select only one layer in the inspector 1 Answer
Checking if the player jumps while not grounded 0 Answers
How do I move a game object only on the x axis with arrow keys? 1 Answer
Having UI follow player 2D C# 0 Answers