Replace the OnTriggerStay method with:
void OnTriggerEnter2D(Collider2D coll){
if (gameObject.tag == "squarerow"){
triggered = true;
}
}
void OnTriggerExit2D(Collider2D coll){
if (gameObject.tag == "squarerow"){
triggered = false;
}
}
The OnTriggerStay only gets called when the trigger are colliding. Therefore, using the if-else within that method is wrong. The if-else refers to the other object having a tag of the name "squarerow", not to object colliding or not.
EDIT: Also you need to fix the bug that you use gameObject.tag instead of coll.gameObject.tag. In both methods it should be:
if (coll.gameObject.tag == "squarerow"){
triggered = false;
}
↧