appeal to the list <>

hello;
I was faced with a problem;
i have a list List<GameObject> Units = new List<GameObject> ();
in this List is recorded GameObject

 void OnTriggerEnter(Collider col) 
    {
        if(col.gameObject.tag == "Drop")
        {
            Units.Add (col.gameObject);
        }
    }

how i can change “Tag” for Units [0] ?
i think about Units [0].tag = "Added";
but it is not working (((

What error do you get, and where in what script? List does allow acces by index so your code as posted should work.

is the list and the trigger function code in the same script? (that space between the listname and first [ is a little telling that it isn’t since the IDE didn’t recognise the name as a collection… )

The access via indexer should work, but all the tags that you want to use must exist (you have to add them to the list in the editor).

Besides that, tags might not be the best solution for this. (Just an assumption based on the code snippets you provided).

VS2015 has settings to allow weird spacing options. Not sure about earlier versions or other editors, I only noticed it in 2015 while looking for something else.

2943194--217864--1.jpg