[Question]Scaling Limits

This question makes me feel quite retarded.

Basically, I have spent the last 3 hours attempting to limit objects from surpassing a certain size.. the objects are not in charge of checking the size, instead I am basing it upon the projectile, which is shifting the size..

like so:

hit.rigidbody.transform.localScale += Vector3(SizeIncreaseX * Time.deltaTime, SizeIncreaseY * Time.deltaTime, SizeIncreaseZ * Time.deltaTime);

However, I cannot figure out how to actually cause it to check the rigidbody it is effecting before it attempts to expand it further..

//blah beginning of function stuff up here
var Scale = BLAH <-- I need to know what to do to check it
if (Scale <= 10)
{
hit.rigidbody.transform.localScale += Vector3(SizeIncreaseX * Time.deltaTime, SizeIncreaseY * Time.deltaTime, SizeIncreaseZ * Time.deltaTime);
Scale = hit.rigidbody.transform;
}

So yeah, basically I would like to have it check the rigidbody before it starts to scale it.. to me it seems more logical then telling each object it needs to check if it is over a certain size.. :/

Anyhow any ideas or suggestions? they'd be quite welcome.. I am entirely tired out.. and am confused as to why it has caused such a problem.. :/

Thanks, Craze

You might find that using localScale.magnitude suits your purpose.

eg:

if (transform.localScale.magnitude <= 10) {
    // increase scale
}