Change tag in random way

Anyone know any way to randomly place a tag in a GameObject group?

I have 4 GameObject

  1. Player001 With Tag “Normal
  2. Player002 With Tag “Normal
  3. Player003 With Tag “Normal
  4. Player004 With Tag “Normal

And I have other Tag “Special”, what I want to do is that this tag is placed in one of the Players randomly

Changing the tag of the object in runtime is a bad approach, but I can’t dive into your problem more now.

If you have a list of all objects with the tag “Normal”. You can simply do something like this:

[SerializeField] private List<Gameobjects> normals; //Your list

private void GiveRandomTag()
    int randomNumber = Random.Range(0, normals.Count);
    normals[randomNumber].tag = "Special"

Now you only need to run this method in your code.

Try changing the layers instead, if that’s not an issue:

gameObject.layer = LayerMask.NameToLayer("YourLayerName");