Hey. I have an object that is constantly moving along the x axis. When the object gets 1 unit past another object, I want to destroy the object. I am getting no errors, but my code is not working. What is wrong? Thanks
function Update(){
var Player = GameObject.Find("Player");
if(transform.position.x==Player.transform.position.x-1){
Destroy (gameObject);
}
transform.Translate(Vector3.right*1*Time.deltaTime);
}