Using Tags

Hello !
In ObjectHit script we wrote that the Object the script is attached to ; is going to changes it’s tag so it’s ganna be “Hit” from now on.
But in Scorer script we were discussing on the player’s tag . so if its hit then dont show the message " You’ve bumped into a thing this many times " …
Why is that ?
Why aren’t we doing stuff to the wall or the game object instead of the player.the player’s tag will be “Player” forever .

In one case the script sets the “Hit” tag in order to mark the object as having been hit. In the other case the tag is only read to see if the colliding object happens to be the player, so the dropper will ignore hitting the ground.

And in the Scorer script it checks for whether the object that’s colliding is already marked as “Hit” and if it isn’t then it’ll add to the score.
(At least in my project. I may not have followed every step of the lecture exactly though because I went ahead sometimes…)

Anyway, the “Player” tag is assigned in the Unity editor to the player object and only read in the scripts. The “Hit” tag is assigned from within the script’s code.

HTH…

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms