Get width of transform (same as scale?)

I want to get the width of an object (or depth, actually, since it is in z-space), but Im not really sure if scale is the same as actual width.

scale defines how much you “stretch” and object. if you make an object, it can have any size you want, when you import (or create) it into unity this will be the standard size (scale = 1). so let’s say you made a house and imported it into unity, this house may be 20m long, so everytime you put it in your scene, you get a house that’s 20m long, but if you want to have a bigger house, you dont have to make a completely new house, if you scale that house up to let’s say 2, this means your house will be 40m long.

regarding the width of an object, i never actually needed it myself, but this should probably help you:

Yeah, thats what I suspected. The bounds-property of the mesh is exactly what Im looking for, but I need to access it via the RaycastHit-structure (since the object I want measured is detected by a Raycast). But apparently the collider also have a bounds-property, so Im guessing I can use the same example but with the collider instead?

that would work also, but you have to make sure that the collider has the same width as the mesh itself. if you are using a mesh collider with the object’s mesh then that won’t be a problem, but other types of colliders may be inaccurate

Well, since Im actually interested in the collider and not the mesh this works perfectly, so thank you very much, dbp :slight_smile: