You've successfully subscribed to Hacking with Unity - Learn how to create your own games
Great! Next, complete checkout for full access to Hacking with Unity - Learn how to create your own games
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.
Success! Your billing info is updated.
Billing info update failed.

How to create and use ArrayList in Unity using C#

How to create and use ArrayList in Unity using CSharp

Ben Liu
Ben Liu

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"));

Ben Liu

Please feel free to contact me if you have any question. <br> https://t.me/NeedoneApp