# How can I check if the scale of an object is bigger (or smaller) than.......?

When starting the game, I make the size of the object random. And when I start the game, how can I check if the object's size is smaller than x-1, y-1, and the z doesn't matter. When I try something I get this error: 'non-invocable member 'Vector3' cannot be used like a method.'

Here is the if statement that the error is in:

if(transform.localScale < Vector3(1, 1, 1))
{

}


I also forgot to mention that the if statement is at the end of the start method.

• This error message is telling you that you're trying to "call" Vector3 like it's a function. It looks like you meant to construct a new Vector3, but you're missing a "new" keyword for that. But more importantly, there's no less-than/greater-than relation defined on vectors, so it's unclear what you want this code to do. If localScale is (0.9, 1.1, 1), should that return true because the x is smaller, or false because y is bigger, or true because the volume 0.9*1.1*1=0.99 is less than the volume 1*1*1=1? Clarify your desired logic first, then we can help you translate that logic to correct code Aug 29 '21 at 11:40
• what I meant was to get the object's size, and check if its size is smaller than 1 on each axis and if it is, then destroy that object. My approach to doing it the way I did was probably wrong and a bit confusing. Aug 29 '21 at 11:46
• So, presumably you tried the obvious thing of if (transform.localScale.x < 1 && transform.localScale.y < 1), right? Did anything go wrong when you did that? Aug 29 '21 at 11:48
• I actually just tried that right now and it worked. I didn't think of doing that. Thanks! Aug 29 '21 at 11:55

I used if(transform.localScale.x < 1 && transform.localScale.y < 1) instead of transform.localScale < Vector3(1, 1, 1) Which seemed to work perfectly.
Vectors can not be compared directly, but you can compare their .magnitude.
• @DavidA_ localScale is a Vector3 😉 Sep 1 '21 at 15:15