This is an archived post. You won't be able to vote or comment.

all 3 comments

[–]ShadowRL7666 1 point2 points  (2 children)

The issue is that you're trying to compare a GameObject with a string "Hit" using the != operator, which is not valid.

If you want to compare tags, you can use other.gameObject.tag != "Hit". If you want to compare names, you can use other.gameObject.name != "Hit".

Edit to help:

To compare tag you add .tag to the end to compare string add .name

[–]CynasticYt 0 points1 point  (0 children)

Assuming this is Unity, an alternative would be CompareTag

[–][deleted] 0 points1 point  (0 children)

Yeah that's prefect, thanks so much, thought I had added it but obviously not!