- Home /
One "else if" statement not working
The 1st else if statement is not working even when conditions are met exactly as it requires... all other statement are working though. I have no idea what i'm doing wrong. All these statements are in a FixedUpdate method.
void FixedUpdate() { if(gameplayElements.beaconActive == false && gameplayElements.GameStart && gameplayElements.cloneActive == false){ rb.transform.position = Vector2.MoveTowards(transform.position, Target.position, Speed * Time.deltaTime);
}
else if(!gameplayElements.beaconActive && gameplayElements.GameStart && gameplayElements.cloneActive){
rb.transform.position = Vector2.MoveTowards(transform.position, Target3.position, Speed * Time.deltaTime);
}
else if(gameplayElements.beaconActive && gameplayElements.GameStart && gameplayElements.cloneActive){
rb.transform.position = Vector2.MoveTowards(transform.position, Target3.position, Speed * Time.deltaTime);
}
else if(gameplayElements.beaconActive && gameplayElements.GameStart){
rb.transform.position = Vector2.MoveTowards(transform.position, Target2.position, Speed * Time.deltaTime);
}
//rb.transform.position = Vector2(GameObject.FindWithTag("Player").transform.position.x * Speed * Time.deltaTime, GameObject.FindWithTag("Player").transform.position.y * Speed * Time.deltaTime);
}
Comment