Hey guys I feel like this is a stupid question but what’s a quick way to get the bounds of a sprite in local space?
I just did this when I had to get the bounds:
public float centerToTop; // manual input eg 1
public float centerToSide; // manual input eg 2
// then later on I got
float topBound = transform.position.y + centerToTop;
float bottomBound = transform.position.y - centerToTop;
float rightBound = transform.position.x + centerToSide;
float leftBound = transform.position.x - centerToSide;
// now I used to check if one of the bounds is outside of the screen
EDIT:
Mesh.bounds
might be what you’re looking for without manual input. Here is a link: Unity - Scripting API: Mesh.bounds