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?