How to scale a gameObject to fit within a Rect. ?

How to scale a gameObject to fit within a Rect.

Use mesh.bounds, which gives you the bounding box of the mesh. Then apply a scale to your mesh such that mesh.bounds fits in your rect.