Hi all, I am making a 2D multiplayer attack game and I have 2 mirror scripts with on trigger enter. So when one of them attacks, and the other gets hit, it should destroy the one that gets hit, but it destroys both of the players. Here are the 2 mirror script’s OnTriggerEnter2D functions:
Unity and c# is very case sensitive, it seems that you’re using “player1” AND “Player1” maybe thats your issue- and like madsks13 said, if you just want it to destroy itself “gameObject” refers to its own gameobject while GameObject refers to an object specifically - Again case sensitive.
Also find is a very expensive method, but obviously works pretty well. And if like the code says you’re just refering to a tag, then never mind all that.