hi, i want the two object “b1” and “b2” appear when the object “Middle” position.x is between them, i tried the code bellow but it doesn’t work for “b2” and i don’t know why. When i change the positions and the difference between them to 2.5 instead 2.6 it works. is there a bug or i’m doing something wrong.
ps : “b2” position.x is -3.9, “middle” is -1.3 and “b1” is 1.3
Thanks
function Update ()
{
if((gameObject.Find("b1").transform.position.x - 2.6) == gameObject.Find("Middle").transform.position.x)
{
gameObject.Find("b1").renderer.material.color.a = 1.0;
}
if((gameObject.Find("b2").transform.position.x + 2.6) == gameObject.Find("Middle").transform.position.x)
{
gameObject.Find("b2").renderer.material.color.a = 1.0;
}
}