Boundary conditions not working

I have given a range for the object, in the Update(). My code goes like this:-

function Update()
{
   if(object.transform.position.x >= -104.3506 && object.transform.position.x <= -91.04906 && object.transform.position.z >= 389.7356 && object.transform.position.z <= 401.3898)
   {
      print("Entered");
      object1.active=true;
      object2.active=true;
   }
   else
   {
      print("gone");
      object1.active=false;
      object2.active=false;
   }
}

Since I was having problems with the OnCollisionEnter() function, I used this thing in my Project. But there seems to be problem. The problem is: Even though, the range is met, the flow is not entering into the if loop. It is entering the else loop Why is this happening?

Hey

In the if() statement, try changing object. to gameObject. and see if that works… Make sure that you have the script attached to the game object that you want to be affected!!!

If you need more help, comment back!

-Grady