transform.localscale

Hi,

I have some questions I haven’t been able to find the answers to yet. I’d like to find the height/width of a game object. I know that Transform.localscale will give me something similar, but as far as I know this is from the center of the object. I cannot find anything that will allow me to either get the height/width of an object or work it out via the scale.

Can someone please help?

You can use Mesh.bounds. This will be an axis aligned bounding box in local space. You will need to scale the box by localScale if you have a scale other than (1,1,1).

function Start() {
 	var bounds = GetComponent(MeshFilter).mesh.bounds;
 	Debug.Log(bounds);
 }