Tags and Hierarchy

Hey all.

I have a series of walls in a level each tagged “wall”.
When I click select a wall I activate a script attached to the wall.
This all currently works well.
This script activates on start and changes the wall tag from “wall” to “wallActive”.
…i.e (gameObject.transform.tag = “wallActive”:wink:
This also all works well.
The problem is instead of changing the tag on the wall I select it changes the tag on the first wall in the Hierarchy.
Is there a way to fix this so unity knows which wall tagged “wall” I am selecting?

Appreciate any help.

Thank you


Hey thanks for your reply Eric5H5

Thanks for the tag=“wallActive” tip :slight_smile:

As for the rest of the puzzle I just worked it out
Instead of when clicking on the wall and getting the first wall tagged “wall” in the hierarchy I added
This makes sure when I select the wall I am clicking on it activates the script on that selected wall and not another wall sharing the “wall” tag.

after I click on the wall I call this function…

function wallDoorScript() {
var wallDoor : WallToDoorScript = Hit.collider.GetComponent(WallToDoorScript);
if (doorLabel.enabled == true && wallDoor != null) {
wallDoor.enabled = true;

wallDoor.Go(); then renames the tag from wall to wallActive.

Sorry if this is all a little vague but its working great now thanks.