How to create and use ArrayList in Unity using C#

How to create and use ArrayList in Unity using CSharp

· 1 min read

Features of ArrayList in Unity:

  • Flexible size, you can add items to it or remove items to it.
  • Not type safe. Data type can be changed while access
  • All elements can be different data type
ArrayList inventory = new ArrayList();
inventory.Add("gun");
inventory.Add(1);
inventory.Add(GameObject.Find("player"));