0
For example I wanted to remove the elements from the list in this way:
public class List : MonoBehaviour {
List<string> inventário = new List<string>();
void Start () {
for(int i = 0;i<=10;i++){
inventário.Add("slot" + i);
}
Debug.Log(inventário[1]);
for(int i=0;i<inventário.Count;i++){
inventário.Remove(inventário[i]);
}
But for some reason it leaves only 5 elements in the array list.
And why would you do that?
– Maniero
To learn more and more about the list command and not to lose the practice of loop for.
– Guest007
You didn’t convince me of the need. I think you’ve learned to do something wrong.
– Maniero