Swapping a tag for string not working, replacing a tag with a public string, help.

hello, what am i doing wrong? sorry im new but i was sure this was going to work, thanks. (im swapping the tag for a string?)

public string Hello;

void Update()
{
GameObject.FindGameObjectWithTag(Hello).SetActive (false); //goes wrong here
}

Hello,I was trying to make it easier for me so instead of making 100’s of scripts to find a gameobject with a tag, thought i would use string instead, so i can edit it outside the script. here’s my code, but it doesnt work? anyways around this. thanks

public string OUTSpeechBubble_NAME;

void Update()
{
GameObject.FindGameObjectWithTag (OUTSpeechBubble_NAME).SetActive (false); //this doesnt work
}

Make sure

  1. You have assigned this public variable a value in the inspector.
  2. You actually have a game object with that tag name in your game.

To check the first point, you can simply put a Debug.Log statement.
To check the second point, you can simply put the double-quoted raw string in that line and check if it is working.

PS: Don’t use FindGameObjectWithTag method in Update loop. This is a heavy method which checks each and every game object. Sooner or later you will find yourself in Performance issues.