Given the challenge to stop the Hits counter from increasing when the player collides with a body that it has already collided with, I understand using the if(other.gametag != Hits) condition, but before this was given, I tried using my own method for this challenge and went with: 2 different methods. One that didn’t work out, and one that did, but might have caused troubles later down the track.
The one that failed:
if(other.gameObject.tag == “Hit”)
{
hits = + 0
}
and the other:
if(other.gameObject.tag == “Fresh”)
{
hits++;
}
(Objects would then change tags from Fresh → Hit tag)
Was there any way with my first method that could have gotten the code to work, and was it possible that method two would have caused an issue further down the line? (For example, needing to have used a different tag for the objects, and only being able to assign them one tag at a time?)
Cheers,