GetComponent<SpriteRenderer>().bounds.size

Hey @Rick_Davidson ,

Wouldn’t it be better to use GetComponent().bounds.size.x, and GetComponent().bounds.size.y for the padding, instead of putting fixed numbers that we need to change whenever we change the sprite, or its size?

Enjoying the course so far BTW. Amazing work!

2 Likes

Yep, its a good idea to protect yourself against baking numbers right into our code.

1 Like

Privacy & Terms